Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
FLASH SALE: Save $500! Use code FLASH2026 at checkout until Feb 14th at 11:59PM ET. Register Now!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Iterno()

Hi all,

I am having data in excel like

EmpGrp  Grade Noofchildren

HCR       G02   >3

In this case, if noofchildren>3 means, it should be as 4, 5

Resultant table should be like as

EmpGrp  Grade Noofchildren

HCR       G02   4

HCR       G02   5

Thanks in Advance,

Nisha loganathan.

1 Solution

Accepted Solutions
tresB
Champion III
Champion III

May be like:

Input:
LOAD EmpGrp,
     Grade,
     PurgeChar(NoofChildren,'<>') As NoofChildren,
     IsNum(NoofChildren) as NumFlag
Inline [
EmpGrp,Grade,NoofChildren
HCC,G01,0
HCR,G02,1
HCM,G03,2
HCC,G01,3
HCR,G02,4
HCM,G03,5
HCC,G01,>3

HCR,G02,>1
]
;

Temp:
Load
Max(NoofChildren) as MaxCh
Resident Input;
Let vMaxChi=Peek('MaxCh');
Drop Table Temp;

Final:

Load
NumFlag,
EmpGrp,
Grade,
NoofChildren+IterNo() as NoofChildren
Resident Input  While IterNo()<=$(vMaxChi)-NoofChildren and NumFlag=0;

Drop Field NumFlag;

View solution in original post

12 Replies
anbu1984
Master III
Master III

Directory;

Initial:

LOAD EmpGrp,

    Grade,

    NoofChildren,

    1 As Key

FROM

testing.xlsx

(ooxml, embedded labels, table is Sheet1);

Join(Initial)

Load 1 As Key,Replace(NoofChildren,'>','') As NoofChildrenNew Resident Initial Where Not(IsNum(NoofChildren));

NoConcatenate

Final:

LOAD * Resident Initial Where NoofChildren > NoofChildrenNew;

Drop table Initial;

exit script;

its_anandrjs
Champion III
Champion III

Hi,

What is your out put in describe and in excel is different

EmpGrp  Grade Noofchildren

HCR       G02   >3 but in file it is G01

 

Resultant table should be like as

EmpGrp  Grade Noofchildren

HCR       G02   4

HCR       G02   5

Regards

Anand

Anonymous
Not applicable
Author

EmpGrp

GradeNoofchildren
HCCG010
HCRG021
HCMG032
HCCG013
HCRG024
HCMG035
HCCG01>3

Resultant table should be like as

EmpGrpGradeNoofchildren
HCCG010
HCRG021
HCMG032
HCCG013
HCRG024
HCMG035
HCCG014
HCCG015

Hi ,

Please check this. Thanks for your reply.

Anonymous
Not applicable
Author

Hi Anand,

Please check my above reply to anbucheliyan. For example i have mentioned like that. Thanks for your reply.

Help me how to acheive the same.

Thanks,

Nisha loganthan.

anbu1984
Master III
Master III

By what logic you generated only two rows? Is it based on Max Header 3 from other rows?

its_anandrjs
Champion III
Champion III

Hi,

Then try this way first load for >3 for 4 logic and then for >3 for 5 logic and concatenate this tables also let me know you have only this single condition

Directory;

LOAD Distinct

     EmpGrp,

     Grade,

     NoofChildren,

     If(NoofChildren = '>3',4,NoofChildren) as NoofChildrenNew

FROM

testing.xlsx

(ooxml, embedded labels, table is Sheet1);

Concatenate

LOAD Distinct

      EmpGrp,

     Grade,

     NoofChildren,

     If(NoofChildren = '>3',5,NoofChildren) as NoofChildrenNew

FROM

testing.xlsx

(ooxml, embedded labels, table is Sheet1);

exit script;


op10.png

Regards

Anand

Anonymous
Not applicable
Author

Hi all,

Thanks for your reply. I have two excel files. In one excel file which contains employee details.

For example emp id , Family status, noofchildren. In that maximum noofchildren is 5.

One more data will be like which i attached for sample. In that noofchildren like 0, 1, 2, >1, >2, 4, 5, >3.

If noofchildren is >2,>3,>1>4, that time i want to expand the records till max no of children 5

Thanks,

Nisha

tresB
Champion III
Champion III

May be like:

Input:
LOAD EmpGrp,
     Grade,
     PurgeChar(NoofChildren,'<>') As NoofChildren,
     IsNum(NoofChildren) as NumFlag
Inline [
EmpGrp,Grade,NoofChildren
HCC,G01,0
HCR,G02,1
HCM,G03,2
HCC,G01,3
HCR,G02,4
HCM,G03,5
HCC,G01,>3

HCR,G02,>1
]
;

Temp:
Load
Max(NoofChildren) as MaxCh
Resident Input;
Let vMaxChi=Peek('MaxCh');
Drop Table Temp;

Final:

Load
NumFlag,
EmpGrp,
Grade,
NoofChildren+IterNo() as NoofChildren
Resident Input  While IterNo()<=$(vMaxChi)-NoofChildren and NumFlag=0;

Drop Field NumFlag;

Anonymous
Not applicable
Author

Thanks Tresco. It is working fine.

Thanks & Regards,

Nisha loganathan