Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
AWS Degraded - You may experience Community slowness, timeouts, or trouble accessing: LATEST HERE
cancel
Showing results for 
Search instead for 
Did you mean: 
abhaysingh
Specialist II
Specialist II

Condition Not working

Hi guys,

I m writing very simple if condition and strange its not working,,pls suggest

if((GL_CC_Flag=1 and  (Cost_Center)= 'NA'  ), Cost_Center=19001,0) as TestCenter;


i want where if((GL_CC_Flag=1 and  (Cost_Center)= 'NA'  ), will true cost centre will feed as 19001

when i m doing below for testing its working means giving output 1 but in above giving output 0

if((GL_CC_Flag=1 and  (Cost_Center)= 'NA'  ), 1,0) as TestCenter;



pls suggest

10 Replies
sunny_talwar

Try this:

If(GL_CC_Flag = 1 and  Cost_Center = 'NA', '19001,0', Cost_Center) as Cost_Center;

Anonymous
Not applicable

How can you assign Cost_Center=19001? Will this work?

try like this?

if((GL_CC_Flag=1 and  Cost_Center= 'NA' ), 19001,Cost_Center) as Cost_Center;

abhaysingh
Specialist II
Specialist II
Author

even not working

Anonymous
Not applicable

what error you are getting?

Sample?

Not applicable

The conditions are diferents;

Tell us what do you want to do?

It is a very thin error. Asing:: Cost_Center=19001, in fact, it could be on another script, Cost_Center=0.


It is true?

abhaysingh
Specialist II
Specialist II
Author

No error still getting NA

Digvijay_Singh

Do you want to assign 190001 to TestCenter when both conditions are true? If yes, then I think below should work.


if(GL_CC_Flag=1 and  Cost_Center= 'NA',19001,0) as TestCenter

Anonymous
Not applicable

try this?


if(GL_CC_Flag=1 ,

if(Cost_Center= 'NA', '19001')) as Cost_Center


Not applicable

Do you are sure that the condition are true? Is it fullied?