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

For Loop

Hi All,

I am facing one issue, my requirement is that suppose I am having onepolicy number i.e ‘1’ which contains 3 members i.e ‘222’, ‘2345’ & ‘4323’and in front of each member there is some amount. But in second case i.esuppose policy number is ‘4’ which also contains 3 members but in this caseamount is available only with one member. So I have to tag policy number 1under ‘INDIVIDUAL POLICY’ where each member is containing some amount whileother policy number i.e 4 under ‘FLOATER POLICY’ because in this case 2 membersare containing 0 amount. I am sending the sample XL for your reference. Memberremains always unique.

I have attached the Excel sheet and also achieved this.

But I need to do the same through some For Loops or While Loop, As i tried but I am not good in LOOPS..... Do any one can help me regarding this.

Let me know in case you need clarification.

6 Replies
Clever_Anjos
Employee
Employee

>> Let me know in case you need clarification.
What´s your issue?

Not applicable
Author

Hi Clever,

Is there any other way to achieve this ??? through Loops or Aggr Funct or else?

Clever_Anjos
Employee
Employee

Well, I don´t see another way, is your code working as expected?

Not applicable
Author

Yes, Its working fine .... DO you have any small app with While loop or For loop .. i have no idea how to impliment that .... I think it can be done in One to four lines of code by some loops ...

Thats what i need !!!!

jagannalla
Partner - Specialist III
Partner - Specialist III

Hello,

I didn't workout fully.. may be it helps you to give a way

Temp:

LOAD Distinct

     Amount as CAmount

FROM

Test.xlsx

(ooxml, embedded labels, table is Sheet1);

LET vCount= FieldValueCount('CAmount');

FOR i=0 to $(vCount)-1

LET vAmount = Peek('CAmount',$(i),'Temp');

IF $(vAmount)=0 then

Concatenate

LOAD *,'Floater' as Flag

FROM

Test.xlsx

(ooxml, embedded labels, table is Sheet1)

Where Amount = 0;

ELSE

Concatenate

LOAD *,'Individual' as Flag

FROM

Test.xlsx

(ooxml, embedded labels, table is Sheet1)

Where Amount <> 0;

ENDIF

NEXT

Clever_Anjos
Employee
Employee

I´m sending you an app that reads all of sheets of a Excel File with a

"FOR"

(See attached file: App07 - Carga Multiplas Planilhas 2.qvw)