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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

solution

Suppose we are having a sales file with columns amount, amount_paid_date and last_paid_date. We have to update the last_paid_date column with the previous value of amount_paid_date when the amount is zero, else the same corresponding date of amount_paid_date should be displayed in the last_paid_date.

 

Id

Amount

Amount_paid_at

Last_paid_date

1

100

03-02-2018

03-02-2018

2

0

Null

03-02-2018

3

0

Null

03-02-2018

4

250

05-12-2018

05-12-2018

5

300

09-01-2019

09-01-2019

6

0

Null

09-01-2019

Labels (1)
  • v7.x

1 Reply
Anonymous
Not applicable
Author

Hi
Link the file input component to a tJavaRow, put the Last_paid_date to global variable if the amount is Not zero. On a tMap, get the Last_paid_date from the global variable if the amount is zero. eg:
tFileInputxxxx--tJavaRow--main(row2)--tMap-->
on tJavaRow:
output_row.Id = input_row.Id;
output_row.Amount = input_row.Amount;
output_row.Amount_paid_at = input_row.Amount_paid_at;
output_row.Last_paid_date = input_row.Last_paid_date;
if(input_row.Amount!=0){
globalMap.put("key",input_row.Last_paid_date);
}

In the expression of Last_paid_date column on tMap,
row2.Amount==0?(String)globalMap.get("key"):row2.Last_paid_date

// Assuming the Last_paid_date is read with string type.

Hope it helps you!

Regards
Shong