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: 
Anonymous
Not applicable

return value based on condition set

Hi,

I would like to show a straight table with a column "Product Name",

available products are:

A. 1,2, 3.....30   (30 different products from the same family)

B. and also products 100, 101, 102...109 (10 different products from the same family)

C. and also products 110, 111, 112...119 (10 different products from the same family)

D. and also products 120, 121, 122...129 (10 different products from the same family)

If the client purchased Product from B family, show the name, if not,

If the client purchased Product from C family, show the name, if not,

If the client purchased Product from D family, show the name, if not,

show nothing.

How can I create such a logic?

I use

6 Replies
sunny_talwar

May be something like this:

If(Len(Trim(Product)) = 2, 'A',

If(Match(Product, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109), 'B',

If(Match(Product, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119), 'C', 'D')))

Anonymous
Not applicable
Author

cool,

how can I return the specific product (not the family)

sunny_talwar

Not sure what you mean?

Anonymous
Not applicable
Author

Sorry I wasn't clearer,

I would like to present the product name to the user,

according to the logic above

11.png

sunny_talwar

Are you trying to do this in the front end of the application or backend?

For backend I would suggest creating a new column for Product Name using Product ID:

LOAD [Product ID],

          'Product ' & [Product ID] as [Product Name]

...

FROM Source;

settu_periasamy
Master III
Master III

May be you can try the sunny's solution in opposite way..

like

If(Product<=30,'Product 1-30',

     If(Product>=100 and Product<110,'Product 100-109'))

....

....