Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Write Table now available in Qlik Cloud Analytics: Read Blog
cancel
Showing results for 
Search instead for 
Did you mean: 
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
Not applicable
Author

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
Not applicable
Author

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'

PrashantSangle

Hi,

Use Bracket() in your script..

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
maxgro
MVP
MVP

Where

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

and State_Code = 'TRM'

Not applicable
Author

Thanks everybody. I used brackets