Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
my issue is to load data from differenz companies dynamically. The exisiting company names can be loaded from the data source.
Then I write all the company names into one field, which I wanted to use as variable for the "for each..next" loop.
But my variable seems to be wrong.
See my code below, which is not working:
unqualify *;
Companies:
LOAD Name,
autonumber(Name) as Linenumber,
'1' as Gruppierung;
SQL SELECT Name
FROM "Database".dbo.Company;
Temp:
LOAD Gruppierung, concat(Name, ',') AS Namensliste resident Companies GROUP BY Gruppierung;
LET currField = 'Namensliste';
LET vCOMPANIES= FieldValue('$(currField)', 1);
unqualify*;
FOR EACH vCOMPANIES in $(vCOMPANIES)
Customer:
LOAD
'$(vCOMPANIES)' as Company,
"No_",
Name;
SQL SELECT *
FROM "Database".dbo."$(vCOMPANIES)$Customer";
store Customer into . /qvd/Customer_$(vCOMPANIES).qvd;
NEXT
If I fill the vCOMPANIES variable manually like this (
SET
But I need to load the companies dynamically from the source db.
You got it right, the only difference is apostrophe (') or chr(39), try adding it like this:
LOAD Gruppierung, concat(chr(39)&Name&chr(39), ',') AS Namensliste resident Companies GROUP BY Gruppierung;