Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Highlighted
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

Re: Creating Conditional Flags in Script

change line no 11 under calendar tab Resident New_GeneralData;

View solution in original post

31 Replies
krishna20
Valued Contributor II

Re: Creating Conditional Flags in Script

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

Re: Creating Conditional Flags in Script

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

buzzy996
Honored Contributor II

Re: Creating Conditional Flags in Script

use this,

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

Not applicable

Re: Creating Conditional Flags in Script

Try like below,


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

Not applicable

Re: Creating Conditional Flags in Script

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
Valued Contributor II

Re: Creating Conditional Flags in Script

Hi,

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

buzzy996
Honored Contributor II

Re: Creating Conditional Flags in Script

the above sytanx tested and it's working..

if possible share ur .qvw?

Not applicable

Re: Creating Conditional Flags in Script

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

Re: Creating Conditional Flags in Script

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;