Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
DirkCtz
Contributor II
Contributor II

Storing Concatenated string into Variable - Variable comes up empty (in script)

Hi,

I have a list of 6000 unique customer details in a qvd. I'm taking the 6000 and splitting them into batches of 1000 as I need to call a 1000 at a time in Teradata script...

I'm successfully splitting the data into the batches, however when I want to store the batches into a variable within script, the variable content keeps on coming up empty as per below - the variable does get created, but the 1000 customer numbers does not store for some reason.

Am I doing something wrong, and can anyone propose a workaround?

DirkCtz_1-1639078224638.png

 

Labels (2)
1 Solution

Accepted Solutions
marcus_sommer

Field-values couldn't be grabbed just by a reference to the field else it requires always a load or field-functions. In your case it should look like:

let var = peek('field-name', /* record-index */ 0, 'table-name');

- Marcus 

View solution in original post

3 Replies
marcus_sommer

Field-values couldn't be grabbed just by a reference to the field else it requires always a load or field-functions. In your case it should look like:

let var = peek('field-name', /* record-index */ 0, 'table-name');

- Marcus 

DirkCtz
Contributor II
Contributor II
Author

Thank you. Managed to get this right with peej just after I posted this.

It now works, but only for the first 1000… the 2nd batch of 1000 and
onwards doesn’t go into the variables 😞
marcus_sommer

I assume it's caused from your loop that you don't fill and/or query the right field/variable at the right time. For example you name the field batch$(i) - do you query afterwards also batch$(i) within the peek(). Something like this will be the reason. Personally I think you don't need to increment the fields and/or these variables else you could use a single one which is appropriate overwritten / assigned within each loop iteration.

- Marcus