cancel
Showing results for 
Search instead for 
Did you mean: 

'like' conditions macro

0 Kudos

I want to use if statement using something like @store1 like '%%%%%%41' in the macro and getting error message. Any thoughts?

Thank you

kvbalakumar
Active Contributor
0 Kudos

Hi,

Hope this question is related B1UP. If yes, could please provide the complete if statement from your UF?

Is it SQL or HANA?

Accepted Solutions (0)

Answers (7)

Answers (7)

kvbalakumar
Active Contributor

Hi,

Macro' IF conditional command is not supporting LIKE statement !

But you can try the below workaround (tested and working!)

@STORE12 = SQL(SELECT CASE WHEN $[$38.1.0] LIKE '%41' THEN 1 ELSE 0 END;
IF @STORE12 = 1
BEGIN
    //Your code here
END
0 Kudos

Ok, I'll try and let you know. Thank you!

0 Kudos

Thank you very much! Your code worked. I have to use or condition along with it. Everything worked correct

kvbalakumar
Active Contributor
0 Kudos

Good to know it worked

0 Kudos

code.png

This is my code

0 Kudos

capture.png.png

Thank you, see attached

0 Kudos

Thank you,

IF@STORE1 LIKE'%41'BEGIN//Your statement here
END is not working. It gives  me an error.  
kvbalakumar
Active Contributor
0 Kudos

Hi,

Could you please debug the UF and provide us the screenshot of the error?

kvbalakumar
Active Contributor
0 Kudos

Hi,

I believe you are storing a SQL statement's result at @STORE1 variable. Instead of comparing the @STORE1 why should not filter the result itself.

For example,

@STORE1 = SQL(Select ItemCode from RDR1 where ItemCode is like '%41’;

If you want to compare @STORE1 then try the below

IF @STORE1 LIKE '%41'
BEGIN
   //Your statement here
END

Regards,

Bala

0 Kudos

Thanks. Yes, its SQL and B1UP. I want to select only items with '41' at the end. I am using @store1 like '%%%%%%41'. It gives me an error