Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
John-SSI
Contributor III
Contributor III

Dimension problem

Hi, 

I want this but i got a crazy zero

If(SmpPillar='Corrective Maintenance','Corrective Workorders' and not(SmpPillar) = 'Corrective Maintenance','Preventive Workorders' ) as NewStatus

I got a zero instead of the text "Corrective Workorders"

 

JohnSSI_0-1698921433778.png

 

Labels (1)
1 Solution

Accepted Solutions
WaltShpuntoff
Employee
Employee

It is not clear what you are trying to do. Perhaps if you show some data and expected output that would help.

In the meantime - your current statement:

If(SmpPillar='Corrective Maintenance','Corrective Workorders' and not(SmpPillar) = 'Corrective Maintenance','Preventive Workorders' ) as NewStatus

SmpPillar appears to be text, so not(SmpPillar) makes no sense.

If(SmpPillar='Corrective Maintenance', // this is your condition to be evaluated as T/F

'Corrective Workorders' and not(SmpPillar) = 'Corrective Maintenance', // this is NOT a  single value

'Preventive Workorders' ) as NewStatus

Also - True/False values and integers: The value of True() is -1, yes minus one.

If you are wanting to nest the IF, that could work.

Are you trying to do something like this:

If(SmpPillar='Corrective Maintenance','Corrective Workorders','Preventive Workorders' ) as NewStatus

Would a simple wildmatch be a better choice?

If(Wildmatch(SmpPillar, 'corrective*'), 'Corrective Workorders', 'Preventative Workorders') as NewStatus

-ws

 

View solution in original post

5 Replies
HKN1
Contributor III
Contributor III

Hi,

not understood.

Could the problem be here?

 

HKN1_0-1698925756595.png

 

WaltShpuntoff
Employee
Employee

There does not seem to be a value specified if the condition is false, so I am not sure what you are trying to do here. Also what is SmpPillar? Is it a logical value? 

-ws

Or
MVP
MVP

If(SmpPillar='Corrective Maintenance','Corrective Workorders' and not(SmpPillar) = 'Corrective Maintenance','Preventive Workorders' ) as NewStatus

Your condition is in red. Your true value is in purple, and it can only result in 0 or 1 since it's a logical condition. Your false value, in blue, looks fine. Presumably, you meant for the true value to be something other than a logical condition?

WaltShpuntoff
Employee
Employee

It is not clear what you are trying to do. Perhaps if you show some data and expected output that would help.

In the meantime - your current statement:

If(SmpPillar='Corrective Maintenance','Corrective Workorders' and not(SmpPillar) = 'Corrective Maintenance','Preventive Workorders' ) as NewStatus

SmpPillar appears to be text, so not(SmpPillar) makes no sense.

If(SmpPillar='Corrective Maintenance', // this is your condition to be evaluated as T/F

'Corrective Workorders' and not(SmpPillar) = 'Corrective Maintenance', // this is NOT a  single value

'Preventive Workorders' ) as NewStatus

Also - True/False values and integers: The value of True() is -1, yes minus one.

If you are wanting to nest the IF, that could work.

Are you trying to do something like this:

If(SmpPillar='Corrective Maintenance','Corrective Workorders','Preventive Workorders' ) as NewStatus

Would a simple wildmatch be a better choice?

If(Wildmatch(SmpPillar, 'corrective*'), 'Corrective Workorders', 'Preventative Workorders') as NewStatus

-ws

 

John-SSI
Contributor III
Contributor III
Author

Thank you . Wildmatch did the trick!!