I think your idea is good enough. Giving a try to your code, something like the following should work, although loops are slower:
DataToLoad:LOAD Concat(Var1, chr(39) & ',' & chr(39)) AS Var1;SQL SELECT Var1 FROM Table1 WHERE ConditionColumn>1; LET vConditionToLoad = chr(39) & FieldValue('Var1', 1) & chr(39); FOR EACH y in $(vConditionToLoad) Data: LOAD *; SQL SELECT * FROM Table2 WHERE Var1 = '$(y)'; NEXT
Some things have to be taken into consideration:
1.- The chr(39) stuff is needed since text literals must be single quoted. It may be some syntax mispelling in my example.
2.- Table "Data" will be concatentated implicitly, meaning all records pulled in each iteration will be appended to the already loaded.
3.- There may be some limitations to the number of characters allowed in a variable, so "vConditionToLoad" may have some limitations, being needed to do some extra loops to get all possible values.
Hope that helps.