Assign specific variables from dynamic datatable


I would like to assign 6 variables from this DT.

Variable1 should be “9485293” if Type is “Forrude”
Variable2 should be 6044AGAMV1P if Type is “Forrude”
Variable3 should be the Type (Forrude)

Variable4 should be “9485299” if Type is “VAP”
Variable5 should be “Viskere” if Type is “VAP”
Variable6 should be the Type (VAP)

The issue is that there can more lines in the DT and therefore more Types to choose from.

I was wondering if a For Each Row could do the trick, but that overwrites the same variables as the previous row assigns.

could it perhaps be a series of if statements? perhaps like this

For each row with severals IF’s in sequence
If row contains “Forrude” Assign items to variables
if row contains “VAP” assign item to variables

Or what would the best approach be?

Best regards

Hey Michael. I would just use a ‘For Each Row’ and then a Switch with ‘Multiple Assigns’ in the different cases. You should also not hardcode the 'row.Item(“blabla”). ToString, like I did, but I kept them that way, so you could see the syntax :slight_smile:

1 Like

Yes off course a switch does the trick.

And is much more nice to look at.
My approach was a series of If’s, but the switch is much easier :slight_smile:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.