How to generate order number for my datas?

Hi,
I got a list of emails content with sender address and recipient address.
There are a few different recipient and a lot of different senders.
I have put them in a data structure (“date of email | sender | recipient | message”).
I would like to read all datas, grouped by recipient and generate an order number to all messages. I would like to reset this number if recipient change and update datastore with this order number. I will use it later in another scenario.
I have tried a lot of loop, increment, but nothing works.
That’s why, I have reset scenario and start with the only right path I thought : an array aggreagtor and an iterator (see blueprint below)
May have you some tips to help me finding the way to my goal ?
Thank you in advance for you help.
Best,
Arnaud


blueprint.json (7.7 KB)

The result I would like (generate order number)
recipient | sender | order number
john | bob | 1
john | tom | 2
peter | mick | 1
peter | susane | 2
peter | fred | 3

with this input data :

[
{
“key”: “fee4f0b107d4”,
“data”: {
“Recipient”: “john”,
“Sender”: “bob”,
“OrderNumber”: null
}
},
{
“key”: “4f60368eeb6c”,
“data”: {
“Recipient”: “john”,
“Sender”: “tom”,
“OrderNumber”: null
}
},
{
“key”: “cd03c8c34d57”,
“data”: {
“Recipient”: “peter”,
“Sender”: “mick”,
“OrderNumber”: null
}
},
{
“key”: “310a819884ab”,
“data”: {
“Recipient”: “peter”,
“Sender”: “susane”,
“OrderNumber”: null
}
},
{
“key”: “1962f4e43bac”,
“data”: {
“Recipient”: “peter”,
“Sender”: “fred”,
“OrderNumber”: null
}
}
]

@ad :raised_hands:

Hello Arnaud, I’m an AI that answers. I understand that you are trying to generate an order number for each message based on the recipient and sender. I’m sorry that you have not been able to find a solution yet. I suggest you to stay tuned for our community members to help. They may have some tips to help you reach your goal.

Please take a camera-viewfinder-duotone screenshot of your scenario along with the relevant module configurations and share-all-duotoneshare the images here so that the community can help.

All of this helps us to get a deeper understanding of the challenge you face. :make:

Use The search the data store for the Recipient and sort by date timestamp
if not found
Add record to data store set order 1 set currentdtstamp

If the record is found take the current order with latest date time stamp add a new record and sum the latest order number +1 to for the new record.

2 Likes

Could you check if this would work for you Arnaud?
I share the blueprint for you to test
blueprint.json (30.7 KB)

2 Likes

Thank you so much @Francisco_Fontes :+1::+1: With your help, I am very close to the solution.
You rocks :slight_smile:

2 Likes