6 Replies Latest reply: Nov 12, 2014 4:24 PM by Stefan Kunte RSS

    Filter a List box based on specific name

    Alam Nizami

      Hi,

       

      I am trying to filter a list box that has names is it. I want only the names I tell it to show in the list box and all the other names to disappear. Is there an expression I could write where I can put in the names I want the list box to show.

       

      Thanks

      Alam

        • Re: Filter a List box based on specific name
          Stefan Kunte

          Hi,

           

          you can create a flag in Script for the names you want to show in your listbox:

           

          Load

          Fields,

          Name,

          if(match(Name, 'X', 'Y', 'Z'), 1) as nameFlag

          From XY;

           

          in your listbox  choose <expression> and enter if(match(nameFlag,1), Name)

           

          Best regards

          Stefan

          • Re: Filter a List box based on specific name
            Steve Taylor

            Are you likely to use this set of names for additional analysis in the future or for other charts?

             

            If so, It is probably worth the time it would take you to create an additional table in your load script:

             

            ReportNames:

            Load * INLINE [

                 PersonID, ReportName

                 1234, Alam

                 5678, Steve

            ];

             

            This is just an example, you'd want some field you could link to the table that contains the name data you're looking for. Only include the names you want listed. You could also populate this table with a Load Resident statement and filter to get only the records you want.

             

            Then just create a listbox with ReportName.

             

            Once this is done, you can use ReportName elsewhere in your application as well and stay away from costly expression constructs involving IF statements and calculated dimensions, etc.