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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Creating Conditional Flags in Script

Hi All,

I am trying to create a conditional flag/statement in a QV script on a QVD that needs some streamlining

The data is pulled in via ODBC and contains mainly SQL and Excel connections.

I am trying to write a statement using fields from multiple locations to create a flag to make analysis a lot easier.

So far I am at

if(ValueID='*24*' and IncidentType='*Accident*')and ([ListTitle]='*Employee*',0,1,) as 7DayFlag

I know this is probably wrong but can anyone point me in the right direction as to how to make this a flag

Thank you in advance


31 Replies
Not applicable
Author

Thanks Harshal for the reply

My noob status however means I am not sure what you mean and where to put in the syntax/script you mentioned.

As before this file is something I have taken over and aside from some excel based reports my script knowledge is low


Not applicable
Author

You have to perform above in script level only...

Not applicable
Author

Thanks Harshal, but as mentioned above where in the script does this go?

Not applicable
Author

Hi,

PFA,

Not applicable
Author

Thanks Harshall

Unfortunately this does not work and I get an error saying "Field ValueID not Found"

Not applicable
Author

PFA,

load script & see whether flag is created or not..

Not applicable
Author

Thanks Harshall

Flag was created but not without  ODBC and other drop table errors (about 10)

Gabriel
Partner - Specialist III
Partner - Specialist III

Hi,

Looking at sample file, these fields are coming from different tables. I'll suggest just have extra flag in each tables and flagging wherever the fields are coming from. i.e.

=If(ValueID = '*24*',0,1)      as 7DayFlag //This will be in the table that have ValueID

=IF(IncidentType = '*Accident*',0,1) as 7DayFlag   //This will be in the table that have IncidentType

=IF([ListTitle] = ''*Employee*'),0,1) as 7DayFlag       //This will be in the table that have ListTitle

The other idea is to bring these fields together into 1 table (concatenate), meaning having 3 table for each field and concatenating then loading this single table as Mapping load.

Anyway try the above ideal and let us know what the result is.

Not applicable
Author

Thanks Gabriel

Would this then create 3 different flags? as I want one flag to mark all 3 criteria so it is easier to use in graphs etc

Toby

Not applicable
Author

It also causes issues with Master Calendar script which looks to the General Data table