Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Attend QlikWorld 2020 and hear keynote speaker, Malcolm Gladwell. Register by February 29th to save $200. Learn More
Highlighted
Not applicable

OR AND statement in Resident

Hi,

The following code with Wrkflow, InputFirst, InputLast and  TerminationFirst works well. Under TerminationFirst I want to replace

where Activity_Code = 'NSX''  and State_Code = 'TRM'

with

Where Activity_Code = 'NSX'' or Activity_Code = 'NSA' or Activity_Code = 'SMX' or Activity_Code = 'SMF' or Activity_Code = 'NSS' or Activity_Code = 'SMR' and State_Code

How can I do it please???

Wrkflow:
LOAD   Process_Code ,
Application_id   as   Application_Id ,
Workitem_Id ,
Activity_Code ,
Timestamp ( Txn_Date ) as   Txn_Date ,
State_Code ,
Assigned_User_Id ,
Assigned_Dept_Id ,
Actioned_User_Id ,
applymap ( 'Trays' , Activity_Code , null ()) as   Tray ,
applymap ( 'Trays' , Activity_Code , null ())& State_Code   as   Link ,
if ( State_Code = 'CMP' , timestamp ( Txn_Date ), null ()) as   [CMP_Date]

FROM

( txt , codepage   is   1252 , embedded   labels , delimiter   is   '\t' , msq ) ;


InputFirst:
LOAD
Application_Id,
FirstValue(Txn_Date) as InputFirstTimestamp
resident Wrkflow
where Activity_Code = 'NBG' and State_Code = 'RDY'
group by Application_Id
order by Txn_Date;

InputLast:
LOAD
Application_Id,
LastValue(Txn_Date) as InputLastTimestamp
resident Wrkflow
where Activity_Code = 'NBG' and State_Code = 'RDY'
group by Application_Id
order by Txn_Date;

TerminationFirst:
LOAD
Application_Id,
FirstValue(Txn_Date) as TerminationFirstTimestamp
resident Wrkflow
where Activity_Code = 'NSX''  and State_Code = 'TRM'
group by Application_Id
order by Txn_Date;

1 Solution

Accepted Solutions
Highlighted
Not applicable

Re: OR AND statement in Resident

I guess:

Where

(Activity_Code = 'NSX'' or Activity_Code = 'NSA' or Activity_Code = 'SMX' or Activity_Code = 'SMF' or Activity_Code = 'NSS' or Activity_Code = 'SMR')

and State_Code = 'TRM'

View solution in original post

4 Replies
Highlighted
Not applicable

Re: OR AND statement in Resident

I guess:

Where

(Activity_Code = 'NSX'' or Activity_Code = 'NSA' or Activity_Code = 'SMX' or Activity_Code = 'SMF' or Activity_Code = 'NSS' or Activity_Code = 'SMR')

and State_Code = 'TRM'

View solution in original post

Highlighted

Re: OR AND statement in Resident

Hi,

Use Bracket() in your script..

Great dreamer's dreams never fulfilled, they are always transcended.
Highlighted
MVP
MVP

Re: OR AND statement in Resident

Where

match(Activity_Code,  'NSX', 'NSA', 'SMX', 'SMF', 'NSS', 'SMR')

and State_Code = 'TRM'

Highlighted
Not applicable

Re: OR AND statement in Resident

Thanks everybody. I used brackets