Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Insert dynamic value into my load table

Hello everyboqy i met an problem,

I explain, i ve an 'extract script" wich extract for every society an FACT table but the information of the society is not into the FACT table and i woul like to add this informatio into all  my society FACT table .....

For that, I try to put into an new field  "Society" an dynamic value but it doesn't work and i don t know how to do...

For the moment, I use  an

SET ListeSte={‘name_society1’, ‘name_society2’,etc….}

FOR each SteEnCours in $(ListeSte)
trace ----------------------------$(SteEnCours)-------------------------------------; //$(SteEnCours)
ODBC CONNECT32 TO $(SteEnCours);

Table_FACT :

LOAD

$(SteEnCours) as Society,

Field1,

Field2,

Field3,

Etc…

From 

SQL  SELECT....

etcC….

STORE Table_FACT into "    .........\$(SteEnCours)_Table_FACT .qvd";

DROP TABLE Table_FACT ;

But the problem with this code the value of society is not the name_society1,2,etc...

For each society table fact the value of the field is = '$(SteEnCours)''

Do you have any idea how to put an value dynamic into my table....

Thanks

Pierre

2 Replies
Not applicable
Author

Hi Pierre,

Use quotes for the variable in  LOAD '$(SteEnCours)' as Society,

SET ListeSte=‘name_society1’, ‘name_society2’;



FOR each SteEnCours in $(ListeSte)
trace ----------------------------$(SteEnCours)-------------------------------------; //$(SteEnCours)
ODBC CONNECT32 TO $(SteEnCours);


Table_FACT :


LOAD


'$(SteEnCours)' as Society,

Field1,

Field2,

Field3,

Etc…

From 

SQL  SELECT....

etcC….


STORE Table_FACT into "    .........\$(SteEnCours)_Table_FACT .qvd";

DROP TABLE Table_FACT ;

Next

Not applicable
Author

Hi, You can pass the variable value into field name as well.

Please use the below script:

SET ListeSte={‘name_society1’, ‘name_society2’,etc….}

FOR each SteEnCours in $(ListeSte)
trace ----------------------------$(SteEnCours)-------------------------------------;//$(SteEnCours)
ODBC CONNECT32 TO $(SteEnCours);

Table_FACT :

LOAD

'$(SteEnCours)' as [$(ListeSte)],

Field1,

Field2,

Field3,

Etc…

From

SQL  SELECT....

etcC….

STORE Table_FACT into "    .........\$(SteEnCours)_Table_FACT .qvd";

DROP TABLE Table_FACT ;