Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
sharatj1989
Contributor III
Contributor III

Need to add new column for existing table which contain the combined data of two other column

I have a table Product_group, which contain 2 column

Product                         Product_2 

SPOT                                SPOT-T

FIX                                     ---------

TOM                                 ----------

SPOT                                 SPOT-T1

SPOT                                 SPOT-T2

i need to add third column DETAILED_PRODUCT which should look as below

  DETAILED_PRODUCT

         SPOT-T

          FIX 

        TOM    

       SPOT-T1

        SPOT-T2

where SPOT need to split in third column like where ever SPOT in Product column should be replace by Product_2.

Please help me with this. thank you

2 Solutions

Accepted Solutions
Gysbert_Wassenaar

If(Len(Trim(Product_2))>0,Product_2,Product) as Product_3


talk is cheap, supply exceeds demand

View solution in original post

sunny_talwar

In that case, try this

If(Len(Trim(Product_1)) > 0, Product_1, Product) as Product_2

View solution in original post

14 Replies
Gysbert_Wassenaar

If(Len(Trim(Product_2))>0,Product_2,Product) as Product_3


talk is cheap, supply exceeds demand
sharatj1989
Contributor III
Contributor III
Author

Is it works if i use below script
If(Product='SPOT',Product_2,Product) as Product_3
sharatj1989
Contributor III
Contributor III
Author

there is some data in Product_2 in place of null

sunny_talwar

Based on your input and output you have shown above, your script above should work... is it not working?
sharatj1989
Contributor III
Contributor III
Author

Thank you sunny,

I am in confusion. In the new column i want Product data where SPOT should replace in the Product_2 column data.

like where SPOT appear in product column should replace by Product_2 .

Is your script works as same.

Thank you in advance.

 

 

 

sunny_talwar

Well not really, What Gysbert provided is saying that if Product_2 is null, then use Product, else Product_2..... but yours is different. But, for the sample you have provided... as long as Product_2 where you have ------ means null... both the expressions will give the same exact output.
sharatj1989
Contributor III
Contributor III
Author

I have Product Product_1 need Product_2 as below

Product           Product_1         Product_2 

SPOT                SPOT_T1            SPOT_T1

FIX                      -----                       FIX

--------               TOM                      TOM

SPOT              SPOT-T2                  SPOT-T2 

SPOT             SPOT-T3                     SPOT-T3

----------         ----------                     ---------------

TOM                FAT                                 TOM

 

according the above i need Product_2 in new column. can you please help me with this.   

sunny_talwar

When you type -------- or -----... does it actually have "-" or is it null?
sharatj1989
Contributor III
Contributor III
Author

---- its null