Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Button to select multiple fields with logical OR

Hello,

I'm trying to find a way to have  a selection of 2 fields with a button.

What I basically want is a button that shows

Sold items that are marked as 'Sold' in the field 'Status'

OR

Sold items that are marked as 'Sold' in the field Inventory

so basically a button with:

Select in Field: Status OR Inventory

Search String: *Sold*

is that somehow possible?

6 Replies
antoniotiman
Master III
Master III

Hi,

If You have

Field,Status,Inventory

A,        a,         Sold

B,        Sold,      b

..........

If You select A, You exclude B.

However ,You can add to script

Load *,

If(Status='Sold' or Inventory='Sold',1) as Flag;

Load  * from .......;        // or SQL Select * from ...;

Then in Your Button -> Select -> Action -> Select in Field Flag -> 1.

Also You can use expression like

Sum({<Status={'Sold'}>+<Inventory={'Sold'}>} Value)

in your objects.

Regards,

Antonio

swuehl
MVP
MVP

Basically you want to select Items, right?


Try creating a button with action Select - Select in field


Field:

Item


Search string:

='=Status like ' & chr(39) & '*Sold*' & chr(39) & ' or Inventory like ' & chr(39) & '*Sold*' & chr(39)

petter
Partner - Champion III
Partner - Champion III

Well the simplest and most straightforward approach I think might be to have a small two column table generated like this in your load script:

AbsolutelySold:

LOAD

     Item,

     (Status = 'Sold') AS DefinitelySold

RESIDENT

     TableWithTheField_Status;

LOAD

     Item,

     (Inventory = 'Sold') AS DefinitelySold

RESIDENT

     TableWithTheField_Inventory;

If the two fields are in the same table you can simplify it like this:

AbsolutelySold:

LOAD

     Item,

     (Status = 'Sold' Or Inventory = 'Sold') AS DefinitelySold

RESIDENT

     TableWithTheTwoFields_Status_and_Inventory;

In you application you can have the field DefinitelySold in a list box and that will act as your button.

bwohletz
Contributor II
Contributor II

@swuehl you are the boss, what an elegant solution, I had to play with the syntax a bit but now it is working,txs

manideep78
Partner - Specialist
Partner - Specialist

Hi @swuehl 

I know this is very old post but I have similar requirement. 

I tried to use the same logic and it didn't work.

the Item field you mentioned here is not in context.

can you please elaborate little more?

 

manideep78
Partner - Specialist
Partner - Specialist

Hi @bwohletz 

I have similar requirement like this, it the syntax worked?

you just have Status and Inventory fields but not sure how Item came into context.