2 Replies Latest reply: Jan 26, 2010 10:34 AM by juergm RSS

    lookup in macro

    juergm

      Hi

      nobody wants to give away how to get a "lookup" equivalent function work in a macro?

      I have a listbox where user makes a selection. The table behind has 2 columns. I need the value of the according second column of the selected value.

      I can step through all items of the listbox and look for the selection. This will give me the index of the selected value in the first column.

      Now I can not find a function that returns me all values from the second column in the table, it looks like only functions exist that give me subsets of the field and my found index of col1 is unusable.

      Juerg

        • lookup in macro
          Stephen Redmond

          Hi Juerg,

          If I have 2 columns, ID and Value, and I make a selection (or selections) on the ID column, then the Concat(Distinct Value, ',') function will give me a list of the associated values in the Value field.

          Now, I can't call Concal from a Macro. But what I can do is create a variable, lets call it vValue, which has a value of :

          =Concat(Distinct Value, ',')

          The "=" causes the Variable to always calculate the value so, if I query the value of the variable then I can get the result - and you can easily query variable values in a Macro.

          Does that do what you want?

          Regards,

           

          Stephen