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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Fred12
Contributor III
Contributor III

How to replace value of champ

Hello, I got a table like it :

 

link                                      Value

AA_2021.xlsm                 P0

AA_2021.xlsm                 P1

AA_2021.xlsm                P2

AA_2022.xlsm               P0

AA_2022.xlsm              P1

AA_2022.xlsm              P2

 

And I would like replace all P0,P1,P2 by the value in link but +1 or +2 if it is P1 or P2.  

I explain myself :

 

link                                      New_Value

AA_2021.xlsm                 2021

AA_2021.xlsm                 2021+1

AA_2021.xlsm                2021+2

AA_2022.xlsm               2022

AA_2022.xlsm              2022+1

AA_2022.xlsm              2022+2

 

I tried to use replace, extract .. But it give me always error ,  thanks for reading me

 

 

Labels (2)
1 Solution

Accepted Solutions
Saravanan_Desingh

Try this,

tab1:
LOAD *, Mid(link,4,4)&If(Right(Value,1)>0,'+'&Right(Value,1)) As New_Value;
LOAD * INLINE [
link, Value
AA_2021.xlsm, P0
AA_2021.xlsm, P1
AA_2021.xlsm, P2
AA_2022.xlsm, P0
AA_2022.xlsm, P1
AA_2022.xlsm, P2
];

commQV30.png

View solution in original post

4 Replies
SunilChauhan
Champion II
Champion II

Test:

Load link,value from path;

New_Test:

Load  *,

tempnewvalue+ num(right(value,1)) as  New_Value;

Load link, value,

Num(Subfield(Subfield(link,'.',1),'_',2)) as tempnewvalue

Resident Test;

Drop table test;

Now load and take columns link and New_Value in table and see the result.

 

Hope this helps

Sunil Chauhan
Saravanan_Desingh

Try this,

tab1:
LOAD *, Mid(link,4,4)&If(Right(Value,1)>0,'+'&Right(Value,1)) As New_Value;
LOAD * INLINE [
link, Value
AA_2021.xlsm, P0
AA_2021.xlsm, P1
AA_2021.xlsm, P2
AA_2022.xlsm, P0
AA_2022.xlsm, P1
AA_2022.xlsm, P2
];

commQV30.png

Fred12
Contributor III
Contributor III
Author

Thanks a lot, it works perfectly !

 

SunilChauhan
Champion II
Champion II

Mark as correct to close this post.

 

Sunil Chauhan