Expand my Community achievements bar.

Join us for the Adobe Journey Optimizer Community Q&A Coffee Break on 4th September at 8 am PT with Journey Optimizer experts Aaron Forest, Justin Grover, Keara Fausett and Sandra Hausmann.

AJO Advance expression editor query

Avatar

Level 3

I am trying leverage Advance experssion under AJO Condition to check if the product quantity is 0.
For this I am using filter function, the reference url is:

https://experienceleague.adobe.com/en/docs/journey-optimizer/using/orchestrate-journeys/building-adv...

 

Here, Everytime I am getting the casting error saying invalid expression

The expression is invalid : The type of the value returned by the expression is invalid. The type is a listObject. Expected type is a boolean.

 

screenshot for reference

mustufam5967803_0-1723532356886.png

 

 

4 Replies

Avatar

Level 1

Hello @mustufam5967803 ,

 

Expression Activity always look for Boolean output.(True/False)

The expression that you have written is returning the object which is not accepted by Condition activity.

 

You can try below expression if that helps,

 

#{PATH_TO_PRODUCT_Array.all(currentDataPackField.product.quantity == 0)}

 

PATH_TO_PRODUCT_Array -> this should be path of your productListItems as er your screenshot.

 

The above expression will return true if all products in the productArray have a quantity of 0, and false otherwise.

 

If you want to check if any product in the array has a quantity of 0, you should use a below approach.

#{PATH_TO_PRODUCT_Array.any(currentDataPackField.product.quantity == 0)}

Avatar

Employee

You can take a look at the examples mentioned in this link https://experienceleague.adobe.com/en/docs/journey-optimizer/using/orchestrate-journeys/building-adv... which has references on how to access attributes within a listObject.

 

Example
@event{demoEvent.productListItems.all(currentEventField.priceTotal >= 150).quantity}==0

 

Avatar

Level 3

Thank you @dugganab and @pradeepg5044331 , 

The all and any functions are somewhat help me but my real pain is I need to sort event data based on product quantity, specifically when the quantity is 0. Is there a way to achieve this in AJO?