I have got a first idea of how to deal with it:
FOR i = 1 to NoOfRows('AllDepartementIDs') LEt vVariable=FieldValue('DepartementID',$(i)); LEt vVariable2=FieldValue('DepartementID',$(i))&'T'; FOR j = 1 to NoOfRows('DepartementData') TempTable: load *,1 as $(vVariable) Resident DepartementData where $(j) = RowNo(); trace $(j); Next j; left join (DepartementData) load *, 1 as $(vVariable2) Resident TempTable; drop table TempTable; Next i;
What I try to do is :
Run through each Departement, and then run through the data for each of them and create a new column which has 0 or 1 in it (now it is just 1 but doesnt matter now).
Then I join the Temp data (with the new column) to the original one and drop it.
The problem now is : It takes a few seconds for EACH of the DepartementData-Rows (which are a few million rows) which I can see by tracing the j-variable. Anyone has got a idea how to do it better (or faster)?