Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

IF Expression is not working well

Hi,

can anyone explain me why in my example the if clause is not working? I think the problem is maybe in the time format. But I working on it over 3 hours and I can#t find the answer...

What I#am doing wrong?

The result must be INSIDE for both and not OUTSIDE

I hope anyone can help me ... THanks

1 Solution

Accepted Solutions
Clever_Anjos
Employee
Employee

I think this should solve your needs

if(frac(MinF) >= MakeTime(Hour(MinF)) AND frac(MinF) < MakeTime(Hour(MinF),30) , 'Inside', 'Outside' ) as StartGK

Be carefull when using timestamp, your Minf was formated as hh:mm:ss but actually still has the date inside it

View solution in original post

8 Replies
Clever_Anjos
Employee
Employee

Your application is full of invalid expressions, is it correct?

Not applicable
Author

Oh ya, I think this is better...

Clever_Anjos
Employee
Employee

Could you kindly guide me where should I check your "IF" that isn´t working?

Capturar.PNG

Capturar2.PNG

Not applicable
Author

Take my new File. The script is important! When you look at the if clause you will see that for ID 1 the min time value is 05:00:00.

And now the if clause is...

If( 05:00:00 >= 05:00:00 AND 05:00:00 < 05:30:00, Inside, Outside )

The result must be Inside but QlikView says Outside. I don't know why...

Clever_Anjos
Employee
Employee

Could you describe your Business rule?

Clever_Anjos
Employee
Employee

I think this should solve your needs

if(frac(MinF) >= MakeTime(Hour(MinF)) AND frac(MinF) < MakeTime(Hour(MinF),30) , 'Inside', 'Outside' ) as StartGK

Be carefull when using timestamp, your Minf was formated as hh:mm:ss but actually still has the date inside it

Not applicable
Author

Oh yess, thank you. But why is the Minf not formated as time? I use time()... And frac is cutting the date?

Clever_Anjos
Employee
Employee

frac() get rid of date part

Try this at script and change the format verifying the differences

LOAD

  date(now()) as date1,

  date(floor(now())) as date2,

  time(now()) as time1,

  time(frac(now())) as time2

autogenerate 1;