how to remove duplicate attribute value entities from the design | Community
Skip to main content
ambikaTewari_ATCI
Community Advisor
Community Advisor
December 16, 2022
Solved

how to remove duplicate attribute value entities from the design

  • December 16, 2022
  • 1 reply
  • 880 views

Hi Team,

 

I would like to skip the entity.Id if its attribute (entity.offerId) has already been shown in the recommendations. I am trying to use velocity logic but this is not running as expected:

 

The design :

#set($uniqueEntities=[])
#foreach($e in $entities)
#if($foreach.index <=12)
#if($uniqueEntities != ($e.offerId))
#set($uniqueEntities=$e.offerId)
#end
$uniqueEntities,
#set($foreach.index = $foreach.index + 1)
#end
#end

 

 

 

Response in request :

"content""OFF-56938,\nOFF-44046,\nOFF-27626,\nOFF-60503,\nOFF-49318,\nOFF-52824,\n1355738,\nOFF-13099,\nOFF-27626,\nOFF-11757,\n1355717,\nOFF-27305,\nOFF-42752,\n\n ",
 
 
I do not want OFF-27626 to reappear again.Each offerId has unique entity.id.
 
Any help on this would be really appreciated.
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 ryanr7

I'm not a scripting expert, but it looks like you are evaluating if a string is equal to an array which seems incorrect.

#if($uniqueEntities != ($e.offerId))

Seems like you need to loop through the array and check if each item is equal.

Hope that helps,

Ryan

1 reply

ryanr7Adobe EmployeeAccepted solution
Adobe Employee
December 19, 2022

I'm not a scripting expert, but it looks like you are evaluating if a string is equal to an array which seems incorrect.

#if($uniqueEntities != ($e.offerId))

Seems like you need to loop through the array and check if each item is equal.

Hope that helps,

Ryan