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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Doubts about an If statements and replacing values.

Hi everybody.

I´ll explain what i did and what i´m trying to do. I know it may be a little large, but i think it´d be useful to understand what im speaking about.

1) I did a conditional to know if my accounts are current and non current.

2) then i did a concatened camp ACCOUNT NUMBER - CURRENT ( OR NON CURRENT).

3) I created an inline table with the same column(2) and another that is called newaccount. If the account is current the account will be the same, but if the account is non current i´ll change the value of the account. Example:

ACCOUNT_Currentornot    NEW_ACCOUNT

222222021-1-Current222222021-1
232222022-2-Current232222022-2
242222023-3-Current242222023-3
252222024-4-Current252222024-4
110302012-1-NO Current12222021-1
132222022-2-NO Current132222022-2
142222023-3-3-NO Current,142222023-3
152222024-4-NO Current,152222024-4

so far so good. Now here is my doubt. I have to replace that numbers in the old account, what i have to do? remember that i have a lot of a accounts. im tinking similar like this

IF(MATCH THIS ACCOUNTS) REPLACE IN THE VALUE "ACCOUNTS" ELSE( i have a lot of null values in "new_account") DONT DO ANYTHING( we continue using the old values).

i´ve been trying to do this in the code but i couldn´t

Any ideas?

Greetings.

1 Solution

Accepted Solutions
jerem1234
Specialist II
Specialist II

Can you explain a little more? What field are you trying to replace the value with? and where are you doing this, in the script, or on the dashboard?

I would have created a new field for if its current or not called like CURRENTFIELD and done something like:

If(CURRENTFIELD = 'Current', ACCOUNT, NEW_ACCOUNT) as CURRENTACCOUNT

Depends on where you are doing this.

Can you post an example dashboard of what you are trying to do?

Hope this helps!

View solution in original post

7 Replies
jerem1234
Specialist II
Specialist II

Can you explain a little more? What field are you trying to replace the value with? and where are you doing this, in the script, or on the dashboard?

I would have created a new field for if its current or not called like CURRENTFIELD and done something like:

If(CURRENTFIELD = 'Current', ACCOUNT, NEW_ACCOUNT) as CURRENTACCOUNT

Depends on where you are doing this.

Can you post an example dashboard of what you are trying to do?

Hope this helps!

danieloberbilli
Specialist II
Specialist II

Please find solution in qvw attached.

Capture14.PNG.png

danieloberbilli
Specialist II
Specialist II

If you also like to delete the '- Current' string from your Account numbers, then use this preceding load to create a clean account field:

Capture14b.PNG.png

Not applicable
Author

yeah i've done something like that. I have a lots of accounts more and i dont know why it doesn't brings the accounts that there arent in the inline table.

its something similar to this.

if (SUBFIELD(CUENTA, '-', 1) = '222' OR '333' or '444' or '555' or '666' or '777' or '888', NEWACCOUNT,ACCOUNT) AS ACCOUNT

Not applicable
Author

*** I've write a very long reply and i don't know why i lost it. Im working on it again.

Not applicable
Author

yeah its something similar to this. But i dont know why it only shows thenewaccount, i doesnt shows the field account. It only brings the inline table.

if (SUBFIELD(CUENTA, '-', 1) = '222' OR '333' or '444' or '555' or '666' or '777' or '888', NEWACCOUNT,ACCOUNT) AS ACCOUNT

I'll try to do an example, but im going to need time to do it.

Not applicable
Author

I've just finished this App.

Thank you all.

Greetings.