Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
parthgandhi487
Contributor II
Contributor II

How to Merge multiple if conditions into one column

I have created five columns using If else condition. Now i want to combine all those 5 columns into one column.

 

Could anyone help me with this. How can we approach to this solution. 

 

I have used crossTable approach, have tried with multiple if conditions but still unable to get the desired result. Could anyone please help on this. 

 

 

Below is my code for reference:

 

if(['color] ='Red', 'True', 'null') as [Reason_code1],
If ([furniture] <> '%chest%' , 'removed','added') as [Reason_code2],
If([id]= 'not null' , 'added' , ' removed') as [Reason_code3],
If( [design]='YES',' Floor Document added', 'removed') as [Reason_code4],
If([interior]>='YES' ,'done' ,'null') as [Reason_code5]

 

I want above 5 columns as one column . could anyone help me on this.

Labels (1)
7 Replies
Or
MVP
MVP

What do you mean by "Combine"? What would be the outcome of this "combination"?

BrunPierre
Master
Master

Hi, are you interested in when the individual conditions are True or False in the combination? What is the logic here?

parthgandhi487
Contributor II
Contributor II
Author

Yes, I want all the conditions as which i mentioned as True or False. It is displaying the same, but it is displaying in 5 different columns. But i want all the columns merged as one and display it 

 

parthgandhi487
Contributor II
Contributor II
Author

Outcome of this combination would be if the condition mentioned in the first if condition is not satisfied, else condition would be displayed , 

 

MayilVahanan

HI

I think, Crosstable will work..

Crosstable(Reason, Values)

Load PrimaryKEY, Reason_code1, Reason_code2, Reason_code3, Reason_code4, Reason_code5 resident yourMaintable;

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
parthgandhi487
Contributor II
Contributor II
Author

Hi MayilVahanan, it partially worked. However my ask is say if i am displaying as [furniture] <> '%chest%, the condition should display as removed not added. It should only display this reason.

However, it is still displaying all the columns for this particular [furniture] <> '%chest% column. 

 

 

Could you please help me with the above solution. 

parthgandhi487
Contributor II
Contributor II
Author

Hi, It would be grateful if anyone offer a help for the above query.