Hello community,
I’ve tried multiple ways to get the output bundles from the last operation of the Search records module, since in my scenario a calculation is performed and some values are added to a key depending on the execution of the scenario. I’ve used an Array aggregator, but it runs all three operations, and I can’t find a solution.
If it helps, I’m sharing my scenario below. Any help will be greatly appreciated. 
Thanks for your collaboration!
Hola comunidad,
he intentado de múltiples formas obtener los paquetes de salida de la última operación del módulo Search records, ya que en mi escenario se realiza un cálculo y suma unos valores a una clave dependiendo de la ejecución del escenario. He usado un array aggregator pero ejecuta las tres operaciones y no encuentro la solución.
Si es de ayuda, os muestro mi escenario. Cualquier ayuda será bien recibida.
Gracias por vuestra colaboración,
1 Like
Hi @Josep_Panella_Gabald Welcome to the community!
You can use sort option within the search module if it can help or you can create an array with the output from search module and sort them in desc order. Make sure to select correct source module to merge searched records in single array. and get the first record after sorting.
I hope this helps!
Best,
@Prem_Patel
Hey Josep,
you can use the last() function on the incoming array. This will give you the last result directly.
Thank you, Prem_Patel, for your help, but I’m not clear about the search module. Can you explain what it is or what steps I need to follow to achieve what you’re telling me?
Best regards,
Gracias Prem_Patel por tu ayuda, pero no tengo claro lo de el módulo de búsqueda. Puedes explicarme cúal es o que pasos debo seguir para lograr lo que me comentas.
Un saludo,
Thanks Stoyan_Vatov for your help, but I already tried that and it doesn’t work, since this function is on an array but only on one execution.
Best regards,
Gracias Stoyan_Vatov por la ayuda, pero esto ya lo probé y no funciona, ya que esta función es sobre un array pero sólo de una ejecución.
Un saludo,
Those are separate bundles so need to aggregate them first! to get the last bundle. last can be used after that aggregation.
You can use sort in Datastore like this.
Before Sort : Check for ID in output as ID is my sort param
After Sort :
If you use array aggregator, in that case you can use last as suggested by @Stoyan_Vatov and if using sort function again on that array for any specific keys, in that case you need to pair it with first function. It depends on if you want last bundle directly or want to sort on specific key and then get the last or first bundle. Formula with function are based on output shown above
I hope this helps!
Best,
@Prem_Patel
Thank you very much for trying to help me. The sorting in the data store works, but I’m stuck at this point. My knowledge is not sufficient; I can’t get only the result of operation 3. I’ve tried creating an array in a variable set, but I still can’t get it to work.
I understood that an array aggregator generates a single output package, but after trying a thousand ways, it always generates the same ones as the previous module (the Data Store or a Set Variable).
Gracias de corazón por intentar ayudarme. La ordenación en el data store funciona, pero estoy atascado en este punto. Mis conocimientos no son suficientes, no puedo obtener solo el resultado de la operation 3. Lo he intentado creando un array en un set variable pero sigo sin conseguirlo.
Tenia entendido, que un array aggregator genera un único paquete de salida, pero probando de mil formas, siempre me genera los mismos que el módulo anterior (el Data Store o un Set Variable)
1 Like
You can update source module in array aggregator as data store and try again. If not working,
Can you please share the sample output json for me to help you with the build? I will explain how it works and you can directly import the solution.
Best,
@Prem_Patel
After trying a thousand combinations to filter the packages I need, without success, I decided to reformulate my scenario, since using Datastore generates duplicate data that I have been able to filter, but there is one bundle that has been impossible for me, and I have given up.
I’ve decided to use a Numeric aggregator, and at least I get what I want. I don’t know if it’s the best option for my scenario, but I was desperate 
Después de intentar mil combinaciones para conseguir filtrar los paquetes que necesito, y sin resultado positivo, he decidido reformular mi escenario, ya que usando Datastore, me genera datos duplicados que he podido filtrar pero hay un bundle que me ha sido imposible, y me he dado por vencido.
He decidido usar un Numeric aggregator, y al menos consigo lo que quiero. No sé si es la mejor opción para mi escenario, pero ya estaba desesperado 