Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Announcing the newest addition to the Qlik Community, Qlik Gallery! Learn More
Highlighted
prasadcm
Contributor II

If else condition in variable

Hi,

I have an expression

=sum({<Distribution={1},[Task Category]={"ERP","Global versions"},

[Task Status]={'Completed', 'Warning'}>}

(if([Task Name]='AP Explorer_SAN',1,if([Task Name]='GM and OP analysis light',1,if([Task Name]='FMG Explorer_SAN',1,if([Task Name]='Reload of Quotation Hit Rate',1,

if([Task Name]='Reload of Sales Variance',1,

if([Task Name]='Reload of Service lead time',1,if([Task Name]='Reference List',1,if([Task Name]='Reload of GL line items',1,if([Task Name]='SO Condition Type',1,

if([Task Name]='Inventory report_SAN',1,

if([Task Name]='Reload of Freight report',1,if([Task Name]='Customer Statistics Finland',1,

if([Task Name]='Macgregor Migrated Project Life Explorer',1,

if([Task Name]='Material Delivery Status',1,

if([Task Name]='CashFlow_SAN',1,

if([Task Name]='Production Order Dashboard',1,

if([Task Name]='Production Order',1,

if([Task Name]='Purchase Orders new Report  Reload',1,

if([Task Name]='Reload Equipment Lead Time',1,

if([Task Name]='Customs reporting Malaysia',1,

if([Task Name]='Parts - Sales Dashboard_SAN',1,

vReloadDailyCount)))))))))))))))))))))))

wherein in if else condition i have task name,1 is the reload frequency(which is once a day for the mentioned apps) & vReloadDailyCount is 2(twice a day for other apps)


now this if else part is used in many places,so i want to put this if condition part in variable or some other way so that i do@nt have to repeat this part everywhere.


How am i supposed to do this?

Regards,

Prasad Mayekar

3 Replies
Partner
Partner

Re: If else condition in variable

Hi Prasad,

You can open the variable overview by pressing CTRL+ALT+V and add a new variable there.

Choose a name, and use that wherever you'd like.

Re: If else condition in variable

Rather create in script which called If ...Else.... Statement and the give it as 1 , 0

Then, Use set analysis something like below

=sum({<Distribution={1},[Task Category]={"ERP","Global versions"}, FlagName = {1},

[Task Status]={'Completed', 'Warning'}>} vReloadDailyCount)

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
effinty2112
Honored Contributor

Re: If else condition in variable

HI Prasas,

The suggestions you've been given are good ones and my suggestion is that your expression may be easier to maintain if written as:

=sum({<Distribution={1},[Task Category]={"ERP","Global versions"},

[Task Status]={'Completed', 'Warning'}>}

if(Match(

[Task Name],

'AP Explorer_SAN',

'GM and OP analysis light',

'FMG Explorer_SAN',

'Reload of Quotation Hit Rate',

'Reload of Sales Variance',

'Reload of Service lead time',

'Reference List',

'Reload of GL line items',

'SO Condition Type',

'Inventory report_SAN',

'Reload of Freight report',

'Customer Statistics Finland',

'Macgregor Migrated Project Life Explorer',

'Material Delivery Status',

'CashFlow_SAN',

'Production Order Dashboard',

'Production Order',

'Purchase Orders new Report  Reload',

'Reload Equipment Lead Time',

'Customs reporting Malaysia',

'Parts - Sales Dashboard_SAN')

,1,2))

I've replaced $(vReloadDailyCount) with 2.

Not so many brackets to keep track of. The if(match(...)) part of this expression can be used in the script as well as the interface.

Kind regards

Andrew