Qlik Community

Qlik DataMarket Discussions

Discussion Board for collaboration regarding Qlik DataMarket.

Not applicable

Multiple if or statement issue

Im using the following script in the Load Statement however it is executing the first data range ok however for the second and subsequent data ranges its returning Null ( please not I have truncated the script just to show two date ranges). Any ideas?

First Date Range

If(dateOccurred >= '2014-02-02' and dateOccurred <='2014-02-08',
if((productType='Home' and ClaimTypeDescription='Storm'or productType='Home' and ClaimTypeDescription='Lightning'or productType='Home' and ClaimTypeDescription='Flood'
or productType='Home' and ClaimTypeDescription='Spoilage of Food' and CauseDescription='Commercial Electricity Supply' or productType='Home' and ClaimTypeDescription='Impact' and CauseDescription='Falling tree/branch'
or productType='Motor Comprehensive' and ClaimTypeDescription='Storm'or productType='Motor Comprehensive' and ClaimTypeDescription='Severe Weather'or productType='Third Party' and ClaimTypeDescription='Storm'
or productType='Third Party' and ClaimTypeDescription='Severe Weather'),'Feb 2014 Wind Storm',

Second Date Range

If(dateOccurred >= '2014-02-13' and dateOccurred <='2014-02-19',
if((productType='Home' and ClaimTypeDescription='Storm'or productType='Home' and ClaimTypeDescription='Lightning'or productType='Home' and ClaimTypeDescription='Flood'
or productType='Home' and ClaimTypeDescription='Spoilage of Food' and CauseDescription='Commercial Electricity Supply' or productType='Home' and ClaimTypeDescription='Impact' and CauseDescription='Falling tree/branch'
or productType='Motor Comprehensive' and ClaimTypeDescription='Storm'or productType='Motor Comprehensive' and ClaimTypeDescription='Severe Weather'or productType='Third Party' and ClaimTypeDescription='Storm'
or productType='Third Party' and ClaimTypeDescription='Severe Weather'),'Feb 2014 Rain',Null())))) as ValidCombo;

2 Replies
ksomosera10
Contributor

Re: Multiple if or statement issue

Hi,

Try this one.

IF(dateOccurred >= '2014-02-13' and dateOccurred <='2014-02-19',

IF(productType='Home' and

   ClaimTypeDescription='Storm'or

   productType='Home' and

   ClaimTypeDescription='Lightning'or

   productType='Home' and

   ClaimTypeDescription='Flood' or

   productType='Home' and

   ClaimTypeDescription='Spoilage of Food' and

   CauseDescription='Commercial Electricity Supply' or

   productType='Home' and

   ClaimTypeDescription='Impact' and

   CauseDescription='Falling tree/branch'or

   productType='Motor Comprehensive' and

   ClaimTypeDescription='Storm'or

   productType='Motor Comprehensive' and

   ClaimTypeDescription='Severe Weather' or

   productType='Third Party' and

   ClaimTypeDescription='Storm' or

   productType='Third Party' and

   ClaimTypeDescription='Severe Weather',

   'Feb 2014 Rain',Null())) as ValidCombo;

Not applicable

Re: Multiple if or statement issue

Hi kevin

Txs for your reply maybe I wasn't clear I want to be able to run as a single script. Breaking them up into either individual expressions or parts in a Load statement works however would require creating a number of these expressions or load scripts. Please note there are no errors when I add in as a Load statement or within and expression just dosent seem to want to evaluate the second and subsequent parts of the expression

Community Browser