0

How could I retrieve values from several columns that are in a row and there various combination of values (key1 = col1, col4, col5), (key2 = col3, col5), (key3 = col3)

I have a Data Extension with several Columns and I want to see what column has the lowest number for a key.

KEY    |    Col1    |    Col2    |    Col3    |    Col4    |    Col5   |
------------------------------------------------------------------------
 key1        5            10            2            3            0
 key2        8             1            5            4            2
 key3        0             0            0            5            1

Now I want to retrieve the values of columns that are specified with each key

I used the LookupRows() but am stuck on how to iterate through the column parameter.

Example:

SET @key1 = col1, col4, col5

SET @key1 = BuildRowsetFromString(@key1,",")
// key1 now has the array of col1, col4, col5

FOR @i = 1 to RowCount(@key1) DO
SET @row = (Row(@key1, @i)
SET @keyvalues = Field(@row,1) 
SET @key1Values = LookupRows("Data Extension", @keyvalues, "KEY", @key)
// I need @keyvalues to loop through the various columns with each iteration so it would pass on the first iteration col1, col4 on the 2nd and so on.

NEXT @i

Ultimately I want to be able to use the output to create statements

 if (@keyvalues != 0 || @keyvalues == 1) THEN
Do Something
ENDIF
0

The answer in this post might help you with looping through rows and columns, take a look: https://salesforce.stackexchange.com/a/147954/17546

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.