Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
sjhussain
Partner - Creator II
Partner - Creator II

Action - Select in Field

Dear All,

Would like to know whether we can have and OR condition in the Search in Field in the Action for Select in Field.

We have two main input boxes.

S1 FromTime, S1 ToTime

S2 Fromtime, S2 ToTime

S1_S2_input.jpg

We would like to use an action button which would filter the times and display times between 7:30 to 11:00 and 12:00 to 13:00 only.

Datalog_Table.jpg

I have the following expression in Select in Field - Search in Field

Field: log_datetimeindata_Hour_Min

Search String: ='>=' & Time(varS1FromTime) & '<' & Time(varS1ToTime) & ' OR ' & '>=' & Time(varS2FromTime) & '<' & Time(varS2ToTime)

Search Field.jpg

I do not know how to use the OR condition to Filter the Time and tried of different approaches.  Can someone help me with how I can achieve this.

Thanks.

1 Solution

Accepted Solutions
MK_QSL
MVP
MVP

Use as per below in search string

='(>=' & Time#(vStart1, 'hh:mm:ss') & '<=' & Time#(vEnd1, 'hh:mm:ss') & '|'

& '>=' & Time#(vStart2, 'hh:mm:ss') & '<=' & Time#(vEnd2, 'hh:mm:ss') & ')'

change variable names and time format accordingly.

View solution in original post

7 Replies
prabhu0505
Specialist
Specialist

Search string can be like below.

=if(isnull(var_name)=-1, expresion1, expression2)

swuehl
MVP
MVP

I think you need a search string like

='=(log_datetimeindata_Hour_Min >= varS1FromTime AND log_datetimeindata_Hour_Min < varS1ToTime)

OR (log_datetimeindata_Hour_Min >= varS2FromTime AND log_datetimeindata_Hour_Min < varS2ToTime)'

sunny_talwar

May be this:

=If(Len(Trim(varS1FromTime)) > 0 and Len(Trim(varS1ToTime)) > 0, '>=' & Time(varS1FromTime, 'h:mm') & '<' & Time(varS1ToTime, 'h:mm'), Time(varS2FromTime, 'h:mm') & '<' & Time(varS2ToTime, 'h:mm'))

MK_QSL
MVP
MVP

Use as per below in search string

='(>=' & Time#(vStart1, 'hh:mm:ss') & '<=' & Time#(vEnd1, 'hh:mm:ss') & '|'

& '>=' & Time#(vStart2, 'hh:mm:ss') & '<=' & Time#(vEnd2, 'hh:mm:ss') & ')'

change variable names and time format accordingly.

sjhussain
Partner - Creator II
Partner - Creator II
Author

Swuehl,

Thanks for the response.  I tried the expression - it is only filtering for S1 not for S2.  I have 7:30-11 and 13:00 - 15:00 and it is only showing data from 7:30-11.

Sincerely,

Syed Jawwad Hussain

sjhussain
Partner - Creator II
Partner - Creator II
Author

Sunny,

Thanks for the response.  I tried the expression - it is only filtering for S1 not for S2 - just as Swuehl.  I have 7:30-11 and 13:00 - 15:00 and it is only showing data from 7:30-11.

Sincerely,

Syed Jawwad Hussain

sjhussain
Partner - Creator II
Partner - Creator II
Author

Manish,

Thanks a lot - it is working like a charm.

SearchFieldCorrectResult.jpg