Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
freddean
Contributor
Contributor

LOAD script - Duplicate row with condition and change 1 field in that row

Hi all,

What I would like to do is:
1. select a row from a populated table where both the fields (portion to prev bucket & portion to curr bucket) have a value > 0
2. put the rows that satisfy that condition into a separate table.
4. in that table I want to change a value to be value - 1 in a specific field (bucket#).
6. I want to concatenate the table with the new rows with the altered bucket# back into the original table.

Below is what my pivot table currently looks like:

WhatsApp Image 2019-10-09 at 7.52.23 AM.jpeg

And this is what I want it to look like:

WhatsApp Image 2019-10-09 at 8.08.00 AM.jpeg

Difference is: in result transaction VF32 exists in bucket 1 and bucket 2. Transaction A445 exists in both bucket 2 and bucket 3

1 Solution

Accepted Solutions
StarinieriG
Partner - Specialist
Partner - Specialist

Hi,

you could try with something like this

TABLE:

LOAD * From Table;

Concatenate (TABLE)

LOAD 

...

(all fields)

...

... as Bucket#

Resident TABLE

Where [portion to prev bucket]>0 or [portion to curr bucket]>0

;

 

If you don't have [portion to prev bucket] and [portion to curr bucket], you need to group by before the where

View solution in original post

2 Replies
StarinieriG
Partner - Specialist
Partner - Specialist

Hi,

you could try with something like this

TABLE:

LOAD * From Table;

Concatenate (TABLE)

LOAD 

...

(all fields)

...

... as Bucket#

Resident TABLE

Where [portion to prev bucket]>0 or [portion to curr bucket]>0

;

 

If you don't have [portion to prev bucket] and [portion to curr bucket], you need to group by before the where

Brett_Bleess
Former Employee
Former Employee

Fred, did Giulia's post help you with things?  If it did, be sure to use the Accept as Solution button on the post to mark it as correct, and give credit.  If you did something else, consider posting that and then marking it, and if you are still working on things, leave an update on where you are.

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.