Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Highlighted
soniasweety
Valued Contributor III

if condition in script

hi all,

I want create a Yes/no  through  if condition how to create this?

logic is :

if(Act_start>PlanStart  and ActEnd<=Plan_End  )    

timeformat : 2018-01-22 15:00:28.000

can anyone help on this?

Thanks

Sony

Tags (3)
7 Replies

Re: if condition in script

If All fields are same format? Why not simply

if(Act_start>PlanStart  and ActEnd<=Plan_End, 'Yes', 'No') as Flag

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)
soniasweety
Valued Contributor III

Re: if condition in script

yes its all same.

I need one more also like   is it correct or not?  with multi values

if(code='Success' or code='Success With No Issues', 'EF','NotEF') as  EF_Flag,

shiveshsingh
Honored Contributor

Re: if condition in script

if(code='Success' or code='Success With No Issues', 'EF','NotEF') as  EF_Flag


Yep it's perfect. You or putting 'OR' condition right.. if any of these conditions get fulfilled, you'll get 'EF' else NotEF

shiveshsingh
Honored Contributor

Re: if condition in script

if(code='Success' or code='Success With No Issues', 'EF','NotEF') as  EF_Flag


Yep it's perfect, if any of these condition fulfils then EF else NotEF

sasiparupudi1
Honored Contributor III

Re: if condition in script

It looks fine but when you are comparing strings care should be taken with the case

another way of doing this especially with multiple values, use match function as it is a lot more neater and sometimes more efficient than if


if(Match(code,'Success' ,'Success With No Issues'), 'EF','NotEF') as  EF_Flag,

Re: if condition in script

please close your thread if your initial question is answered:

Qlik Community Tip: Marking Replies as Correct or Helpful

thanks

regards

Marco

srinivas_raidi
New Contributor

Re: if condition in script

if condition in qlikview is :

if(condition , then , else)

as per you requirement:

if (condition,'true','false') as flag


if condition is satisfied,expression returns true/yes else returns false/no.