Email Scripting - Filtering Unique Records | Community
Skip to main content
New Participant
October 23, 2021
Question

Email Scripting - Filtering Unique Records

  • October 23, 2021
  • 1 reply
  • 3254 views

Does anybody know a way to filter/select only unique values of a certain field from a foreach statement via email scripting? I

 

We have different coverage type in addition to the Registration. The email has a table that includes the customer's Serial Number and Product Coverage combined into one row. The problem is that they are all part of the same object and the main registration and coverage are tied together via the same serial number, so this is creating more line items than we need.

 

So I'm trying to look for a way to just filter my list to only show unique Serial Numbers per line item.  

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

1 reply

Jo_Pitts1
Community Manager
October 23, 2021

@ameys89771464 ,

can you show us:

  • What you mean around the data (some screenshots or examples)
  • What you want your output to be
  • What you've attempted so far

I THINK I know what you're looking for, but I'm not 100% certain. 

 

Cheers

Jo

Jo_Pitts1
Community Manager
October 24, 2021

@ameys89771464 ,

you also might want to review the solution in this thread (posted by you).

https://nation.marketo.com/t5/product-discussions/capture-specific-type-from-co-with-velocity-script/td-p/317226

 

That might get you close.

 

Regards

Jo 

New Participant
October 24, 2021

Hi @jo_pitts1 , yeah I used that solution as my base and its got me close. I was able to get a list of all the asset type. A sample output is below for a customer is below. The first 2 rows is just what I want and then not show the red text rows. Because the serial number column and product protection share the same serialNumber. I would like to just only how unique value of serial numbers. I have another solution in place and forgot to save the code snippet for the below, but its inline basically with the code snippet from my previous post you listed above. 

 

A sample output looks like this:

Serial Number [type__c][serialNumber] Limited Warranty [usageDate] Product Protection [type_-c][usageDate]
ABCDEFG 10/21/21 - 12/21/24 Gold: 10/21/24-10/21/26
ZYXWVU 10/21/21 - 12/21/24 Plat: 10/21/24-10/21/26
ABCDEFG 10/21/21 - 12/21/24 Request a Quote
ZYXWVU 10/21/21 - 12/21/24 Request a Quote