Aller au contenu principal

How do I create an expression to count the number of unique values?

Commentaires

1 commentaire

  • Permanently deleted user

    Hi @Ethan Granger?,

     

    I was able to implement this with a c# script using GR5 On-Premise. My print template counts the number of features and also unique user names.

     

    View from the Designer:

    GR5_uniqueFeatures_designer.png

     

     

     

    Output PDF:

    GR5_uniqueFeatures_out

     

     

    The documentation for creating scripts is here:

    https://docs.geocortex.com/reporting/latest/help/Default.htm#rpt5/help/scripting.htm

     

    Script for this report:

    using System; using System.Collections; using System.Collections.Generic; using System.Runtime.Serialization;   HashSet<String> uniqueUsers = new HashSet<String>();   private void Detail1_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e) { uniqueUsers.Add(GetCurrentColumnValue("created_user").ToString());   }   private void label9_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e) {   label9.Text = uniqueUsers.Count.ToString(); }

     Edit: Added more detail.

    0

Vous devez vous connecter pour laisser un commentaire.