Question

Custom event condition

  • 27 September 2023
  • 6 replies
  • 129 views

Userlevel 1
Badge +8

Hello , 

 

I want to know what’s the right syntax to use the condition in custom event :

my condition is : NEW:CUSTOMER like 25% OR 15%.

Here what I’ve used , but it doesn’t work , I guess it’s a wrong syntax , Can anyone help me with that ?

 

Thank you in advance ,

Hanane


6 replies

Userlevel 7
Badge +31

Hi @Hanane,

Semi-colon should be the correct operator. Have you tried enclosing the values in single quotes? 

Eg: ‘25%’;’15%’

hope this helps!

Userlevel 2
Badge +9

Hello @Hanane 

That wouldn’t be a nice solution, but I would make 2 custom actions.

On your first one, you would define the condition :

NEW:CUSTOMER_ID like 15%

And a second one with the condition

NEW:CUSTOMER_ID like 25%

 

Inside these 2 custom actions, you would put the exact same code

Userlevel 5
Badge +14

Hi @Hanane,

Semi-colon should be the correct operator. Have you tried enclosing the values in single quotes? 

Eg: ‘25%’;’15%’

hope this helps!

I didn’t know it. :)

 

Hello @Hanane 

That wouldn’t be a nice solution, but I would make 2 custom actions.

On your first one, you would define the condition :

NEW:CUSTOMER_ID like 15%

And a second one with the condition

NEW:CUSTOMER_ID like 25%

 

Inside these 2 custom actions, you would put the exact same code

Probably, If I were faced with this scenario, I would use this way.

 
Userlevel 1
Badge +8

Hello ,

Thank you all for the replies .

the single quotes didn’t work for me .

I included my conditions in my code , so it worked .

I used @romsar idea on another project , it’s very handy as well !

 

Kind Regards,

Hanane

Userlevel 2
Badge +9

Hello.

Another idea and more handy than the idea I suggested would be to create a custom attribute.

In name, I would put IS_CUSTOMER_ID_OK

In server method, I would put something like 

MyPackageName.Get_Is_Customer_ID_OK(&NEW:CUSTOMER_ID)

 

I would define the procedure like this :

 

FUNCTION Get_Is_Customer_ID_OK(P_CUSTOMER_ID VARCHAR2) RETURN number

IS

BEGIN

 IF P_CUSTOMER_ID LIKE ‘15%’ OR P_CUSTOMER_ID LIKE ‘25%’ THEN

    RETURN 1;

ELSE

    RETURN 0;

END IF;

END Get_Is_Customer_ID_OK;

 

So, with this new attribute, in the event action screen, you put as new condition

IS_CUSTOMER_ID_OK = 1

And this way, you would have just 1 custom action.

Userlevel 1
Badge +8

It’s a great idea if the conditions are the same .

My requirement is different for each customer_id ( depending on the prefix ) , so I’ll stick with two action events .

 

Thank you ,

Hanane

Reply