Qlik Community

Qlik Sense Data Connectivity

Discussion board where members can learn more about Qlik Sense Data Connectivity.

Announcements
QlikWorld 2020: Join us May 11 - 14, 2020 in Phoenix, AZ. Register early and save $400. Learn More
Highlighted
rsdhavle
Contributor 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 (2)
3 Replies

Re: For loop in Qliksense Script

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.
rsdhavle
Contributor II

Re: For loop in Qliksense Script

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?

Re: For loop in Qliksense Script

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.