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

If condition

Hi all,

One more question in writing a If condition!!

I am trying to filter data using if condition where I need to compare two fields. For example:

Let the fields be

1.Flag:  which has only 1 and 0 value in it.

2. Name: This field has data something like this

Name

abc

bcd

rfg

3. Cname

4. Num : This field has data something like this :

Num          

1234557

4567869

7864325

abc_123

bcd_567

rfg_675.


Note :Starting of some data in Num field resembles the data in Name. For example

Name                  Num

abc                    abc_123

bcd                   bcd_567

rfg                     rfg_675.


I need to bucket in the data for a field called "room" for a condition

Flag =1 or

Num = only that data which Starts with Name field.( Example = abc_123, bcd_567, rfg_675).


So expression should be like

If( Flag ='1' or Num = ' Like Name', Name, Cname) as room.

I hope I have explained in a simple way. Thank you.

Regards,

PV

1 Solution

Accepted Solutions
krishnacbe
Partner - Specialist III
Partner - Specialist III

There was a Typo. Please use below expression

if( Flag=1 or  WildMatch(Num, '*' & Name & '*'), Name, Cname)  as room

View solution in original post

7 Replies
krishnacbe
Partner - Specialist III
Partner - Specialist III

Hi,

Try below script.

if( Flag=1 or  WildMatch(Num, '*' & Name & '*', Name, Cname)  as room

krishnacbe
Partner - Specialist III
Partner - Specialist III

There was a Typo. Please use below expression

if( Flag=1 or  WildMatch(Num, '*' & Name & '*'), Name, Cname)  as room

Anil_Babu_Samineni

May be use this If( Flag =1 or Num like Name, Name, Cname) as room

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Anonymous
Not applicable
Author

Hi Krishnapriya,

Thanks for the reply, I am getting the data when the condition is true but this time it's not bucketing the data if condition is false. That means the values for Cname are not populating.

krishnacbe
Partner - Specialist III
Partner - Specialist III

I have verified with sample data, both true and false case is working fine.

Please find attached sample.

share me the false condition which is failing.

Anonymous
Not applicable
Author

Thank you Krishnapriya, it's working.

krishnacbe
Partner - Specialist III
Partner - Specialist III

Great. Please mark the correct answer and close the thread.