AJO Advance expression editor query | Community
Skip to main content
Level 3
August 13, 2024
Solved

AJO Advance expression editor query

  • August 13, 2024
  • 2 replies
  • 1652 views

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-advanced-conditions-journeys/main-functions-journey/list/functionfilter

 

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

 

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Mohan_Dugganab

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

 

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

 

2 replies

Adobe Employee
August 13, 2024

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)}

Mohan_Dugganab
Adobe Employee
Mohan_DugganabAdobe EmployeeAccepted solution
Adobe Employee
August 13, 2024

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

 

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

 

Level 3
August 13, 2024

Thank you @mohan_dugganab and @gujamaga , 

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?

 

 

Mohan_Dugganab
Adobe Employee
Adobe Employee
August 13, 2024