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

Announcements
Now accepting applications for the Qlik Luminary and Partner Ambassador Programs: Apply by July 6!
cancel
Showing results for 
Search instead for 
Did you mean: 
brunopaulo
Partner - Creator II
Partner - Creator II

Cycle in Script

Hi comminity,

I have a table like a following one

Field 1      |       Field 2     |         Field 3

A                         test1               fjhafjhf

A                                                fjhsfjhf

A                                                jfhuhf

A                         test2               fjskfhdkf   

A                                                fjkksafjfads

B                                                fhagdhsgd

B                                                sijisjff

C                                                dfjfjfk                                               

Expected outcome

Field 1      |       Field 2     |         Field 3

A                         test1               fjhafjhf

A                         test1               fjhsfjhf

A                         test1               jfhuhf

A                         test2               fjskfhdkf   

A                         test2               fjkksafjfads

B                                                fhagdhsgd

B                                                sijisjff

C                                                dfjfjfk   

Im loading several excel files and each one has 1 table like the first.

i want to do a cycle for each file to do this table a peek field2  a replace the null value for above until field1 is A. when b appear on field 1 stop fill and let the empty space.
I tryed some differente ways nothing seems to work.
Any ideas?

Thanks in advance

Best Regards,

Bruno Paulo

Labels (1)
1 Solution

Accepted Solutions
Colin-Albert
Partner - Champion
Partner - Champion

Hi Bruno,

Have you seen this post?  Generating Missing Data In QlikView

The example "Propagate a value downwards " covers your situation, though you will need to add another test to check if Field1 = peek(Field1) to see if the value has changed from the previous row.

View solution in original post

6 Replies
prieper
Master II
Master II

Did you check the wizard when creating the script? under "Transform" and then "Fill"?

avinashelite
MVP
MVP

Try like this in the script

if( len(trim(Field2))=0,peek('Field2'),Field2) as Field 2

brunopaulo
Partner - Creator II
Partner - Creator II
Author

Yes, but i dont like wizard. It only makes static codes. For this case can result but any change on excel file will return errors.

Colin-Albert
Partner - Champion
Partner - Champion

Hi Bruno,

Have you seen this post?  Generating Missing Data In QlikView

The example "Propagate a value downwards " covers your situation, though you will need to add another test to check if Field1 = peek(Field1) to see if the value has changed from the previous row.

brunopaulo
Partner - Creator II
Partner - Creator II
Author

Exactly what i needed. (couldnt found this, thank you!)

brunopaulo
Partner - Creator II
Partner - Creator II
Author

with some work this result as well thank you!

Best Regards

Bruno