Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
rsdhavle
Creator II
Creator II

For loop in Qliksense Script

I have list of account numbers like a1,a2,a3...
I am fetching some data for corresponding accounts from different db and it has huge records..while fetching this records i want to fetch records for 1 account at a time at qliksense level and then consolidate data here..how can i pass 1 account at a time in variable while fetching data from other system and then loop it for other all accounts
Labels (1)
3 Replies
PrashantSangle

Hi,

 

Try below logic

1: Load all accounts in one table

accounts:

Load distinct accountID from table;

 

2: Use For loop like

For i=0 to NoOfRows('accounts') - 1

let vaccountID = peek('accountID',$(i),'accounts');

connectionstring

AccountsDetails:

Load * ;

Select * from table 

where accountId='$(vaccountID)';

Next i;

drop table accounts;

 

Regards,

Prashant Sangle

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
rsdhavle
Creator II
Creator II
Author

Prashant..In case I have to submit bunch of accounts at a time in a variable instead of 1 account at a time can we do it here?

PrashantSangle

Hi,

Yes you can instead of = use wildmatch() and value which you are passing in variable should be comma(,) separated
Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂