Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
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


1 Solution

Accepted Solutions
Not applicable
Author

change line no 11 under calendar tab Resident New_GeneralData;

View solution in original post

31 Replies
krishna20
Specialist II
Specialist II

Hi,

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

Is above are from same table?

If yes add this expression in preceding load and proceed.

Not applicable
Author

Thanks for the reply Krishna, but no the fields are loaded in separate tables

buzzy996
Master II
Master II

use this,

IF(wildmatch(ValueID,'*24*') and wildmatch(IncidentType,'*Accident*') and wildmatch(ListTitle,'*Employee*'),'0','1' ) as Flag

Not applicable
Author

Try like below,


if(wildmatch(ValueID,'*24*')  and wildmatch(IncidentType,'*Accident*') and wildmatch([ListTitle],''*Employee*'),0,1) as Flag

Not applicable
Author

Thanks for the answers

It still does not seem to work and I get an error.

Being a complete newbie can this go on a separate line on a new tab or does it need more syntax or to be in the same tab as the load?

krishna20
Specialist II
Specialist II

Hi,

I think you can achieve it by using Apply Map concept.

buzzy996
Master II
Master II

the above sytanx tested and it's working..

if possible share ur .qvw?

Not applicable
Author

I have attached the QVW it is very much a work in progress.


Datasource has caused a predecessor a lot of headaches and I am trying to go through and streamline it

Not applicable
Author

Hi,

In Data modeling you need to try like below ,

GeneralData:

//data load;

left join(GeneralData)

mel_InjuryAccidents:

//data load;


left join(GeneralData)

search_Incident_StatusFlags:

//data load;


Noconcatenate

New_GeneralData:

LOAD

*,

if(wildmatch(ValueID,'*24*')  and wildmatch(IncidentType,'*Accident*') and wildmatch([ListTitle],'*Employee*'),0,1) as flag

Resident GeneralData;

drop table GeneralData;