Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

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

Re: Insert dynamic value into my load table

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

Re: Insert dynamic value into my load table

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 ;