Join json files to one file and sort them

Hello,
With the great support of @E1cid I was able to filter a json database (Filter json database with conditions

Now I would like to join two json files to one json file and sort the result file by a select variable (for example price).
My current node red flow look like this

[{"id":"e6926a4555f50a3e","type":"inject","z":"67e5e39e7b6a8e54","name":"","repeat":"","crontab":"","once":false,"topic":"","payload":"","payloadType":"date","x":320,"y":1560,"wires":[["d00f26c8017f46e9","87b3ecbe3f2daf0f"]]},{"id":"d00f26c8017f46e9","type":"function","z":"67e5e39e7b6a8e54","name":"set payload and headers","func":"msg.headers = {};\nmsg.headers = {\n};\n\n\nmsg.payload = {};\nmsg.payload = {\n    'region' : 9,\n    'province': 'RM',\n    'town' : 'Monterotondo',\n    'priceOrder':'desc', \n    'fuelType': '1-1',\n    'refuelingMode': 1\n};\n\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":510,"y":1560,"wires":[["1d8bb51c38acb99a"]]},{"id":"1d8bb51c38acb99a","type":"http request","z":"67e5e39e7b6a8e54","name":"post to HttpBin","method":"POST","ret":"obj","paytoqs":"ignore","url":"https://carburanti.mise.gov.it/ospzApi/search/area","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":720,"y":1560,"wires":[["0a4e9c551c73218d","89f87e77215f7336","aab2cfb4326f6be6"]]},{"id":"0a4e9c551c73218d","type":"debug","z":"67e5e39e7b6a8e54","name":"debug 201","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":910,"y":1540,"wires":[]},{"id":"89f87e77215f7336","type":"change","z":"67e5e39e7b6a8e54","name":"","rules":[{"t":"set","p":"fuelId","pt":"msg","to":"1","tot":"num"},{"t":"set","p":"name","pt":"msg","to":"Benzina","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"($$.payload.results{\t   $.name: {\t       \"name\": $.name,\t       \"fuels\": [$.fuels[$.fuelId = $$.fuelId and $.name = $$.name]],\t       \"insertDate\":$.insertDate\t   }\t}).*[$exists($.fuels[0])]","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":540,"y":1680,"wires":[["be1bf5946d6e9650","c6137e1d72f2da72"]]},{"id":"be1bf5946d6e9650","type":"template","z":"67e5e39e7b6a8e54","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{{#payload}}\nName company: {{name}}\n-------------\n{{#fuels}}\nprice: {{price}}\nfuel: {{name}}\nisSelf: {{isSelf}}\n-------------\n{{/fuels}}\nDate and time: {{insertDate}}\n______________\n\n{{/payload}}\n{{^payload}}No Result for\nname: {{name}}\nfuelId: {{fuelId}}{{/payload}}","output":"str","x":740,"y":1680,"wires":[["89cad60e79bf2836"]]},{"id":"c6137e1d72f2da72","type":"debug","z":"67e5e39e7b6a8e54","name":"debug 203","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":790,"y":1760,"wires":[]},{"id":"89cad60e79bf2836","type":"debug","z":"67e5e39e7b6a8e54","name":"debug 199","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":930,"y":1680,"wires":[]},{"id":"87b3ecbe3f2daf0f","type":"function","z":"67e5e39e7b6a8e54","name":"set payload and headers","func":"msg.headers = {};\nmsg.headers = {\n};\n\n\nmsg.payload = {};\nmsg.payload = {\n    'region' : 9,\n    'province': 'RM',\n    'town' : 'Agosta',\n    'priceOrder':'desc', \n    'fuelType': '1-1',\n    'refuelingMode': 1\n};\n\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":530,"y":1900,"wires":[["d511023821c3a924"]]},{"id":"d511023821c3a924","type":"http request","z":"67e5e39e7b6a8e54","name":"post to HttpBin","method":"POST","ret":"obj","paytoqs":"ignore","url":"https://carburanti.mise.gov.it/ospzApi/search/area","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":740,"y":1900,"wires":[["89c23c9e7df590a6","b3046250be4cc311","aab2cfb4326f6be6"]]},{"id":"89c23c9e7df590a6","type":"debug","z":"67e5e39e7b6a8e54","name":"debug 217","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":930,"y":1880,"wires":[]},{"id":"b3046250be4cc311","type":"change","z":"67e5e39e7b6a8e54","name":"","rules":[{"t":"set","p":"fuelId","pt":"msg","to":"1","tot":"num"},{"t":"set","p":"name","pt":"msg","to":"Benzina","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"($$.payload.results{\t   $.name: {\t       \"name\": $.name,\t       \"fuels\": [$.fuels[$.fuelId = $$.fuelId and $.name = $$.name]],\t       \"insertDate\":$.insertDate\t   }\t}).*[$exists($.fuels[0])]","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":560,"y":2020,"wires":[["906ea31eae12fee7","1d5da510e5110d93"]]},{"id":"906ea31eae12fee7","type":"template","z":"67e5e39e7b6a8e54","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{{#payload}}\nName company: {{name}}\n-------------\n{{#fuels}}\nprice: {{price}}\nfuel: {{name}}\nisSelf: {{isSelf}}\n-------------\n{{/fuels}}\nDate and time: {{insertDate}}\n______________\n\n{{/payload}}\n{{^payload}}No Result for\nname: {{name}}\nfuelId: {{fuelId}}{{/payload}}","output":"str","x":760,"y":2020,"wires":[["551c0407369f8d41"]]},{"id":"1d5da510e5110d93","type":"debug","z":"67e5e39e7b6a8e54","name":"debug 218","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":810,"y":2100,"wires":[]},{"id":"551c0407369f8d41","type":"debug","z":"67e5e39e7b6a8e54","name":"debug 219","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":950,"y":2020,"wires":[]},{"id":"aab2cfb4326f6be6","type":"join","z":"67e5e39e7b6a8e54","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"1","count":"0","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":470,"y":2260,"wires":[["b6a83593b4551f9f","27a1795543c05c1d"]]},{"id":"b6a83593b4551f9f","type":"change","z":"67e5e39e7b6a8e54","name":"","rules":[{"t":"set","p":"fuelId","pt":"msg","to":"1","tot":"num"},{"t":"set","p":"name","pt":"msg","to":"Benzina","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"($$.payload.results{\t   $.name: {\t       \"name\": $.name,\t       \"fuels\": [$.fuels[$.fuelId = $$.fuelId and $.name = $$.name]],\t       \"insertDate\":$.insertDate\t   }\t}).*[$exists($.fuels[0])]","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":660,"y":2260,"wires":[["643e4cdfda6c0da0"]]},{"id":"643e4cdfda6c0da0","type":"debug","z":"67e5e39e7b6a8e54","name":"debug 220","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":870,"y":2260,"wires":[]},{"id":"44758031a002dade","type":"template","z":"67e5e39e7b6a8e54","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{{#payload}}\nName company: {{name}}\n-------------\n{{#fuels}}\nprice: {{price}}\nfuel: {{name}}\nisSelf: {{isSelf}}\n-------------\n{{/fuels}}\nDate and time: {{insertDate}}\n______________\n\n{{/payload}}\n{{^payload}}No Result for\nname: {{name}}\nfuelId: {{fuelId}}{{/payload}}\n\n\n","output":"str","x":960,"y":2380,"wires":[["8fa654d6fa901096"]]},{"id":"8fa654d6fa901096","type":"debug","z":"67e5e39e7b6a8e54","name":"debug 208","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1150,"y":2380,"wires":[]},{"id":"27a1795543c05c1d","type":"change","z":"67e5e39e7b6a8e54","name":"","rules":[{"t":"set","p":"name","pt":"msg","to":"Gasolio","tot":"str"},{"t":"set","p":"fuelId","pt":"msg","to":"2","tot":"num"},{"t":"set","p":"isSelf","pt":"msg","to":"true","tot":"bool"},{"t":"set","p":"payload","pt":"msg","to":"($$.payload.results{\t       \"name\": $.name,\t       \"fuels\": [$.fuels[$.fuelId = $$.fuelId and $.name = $$.name and $.isSelf = $$.isSelf]],\t       \"insertDate\":$.insertDate\t   })","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":740,"y":2380,"wires":[["44758031a002dade","5df0dd3028b87836","47399c1d046c9895"]]},{"id":"5df0dd3028b87836","type":"debug","z":"67e5e39e7b6a8e54","name":"debug 221","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":930,"y":2460,"wires":[]},{"id":"47399c1d046c9895","type":"ui_table","z":"67e5e39e7b6a8e54","group":"e291a9746f2f79dd","name":"","order":0,"width":0,"height":0,"columns":[{"field":"name","title":"company","width":"","align":"left","formatter":"plaintext","formatterParams":{"target":"_blank"}},{"field":"price","title":"Price","width":"","align":"left","formatter":"plaintext","formatterParams":{"target":"_blank"}}],"outputs":0,"cts":false,"x":1150,"y":2300,"wires":[]},{"id":"e291a9746f2f79dd","type":"ui_group","name":"Default","tab":"fdfa5af28343e428","order":1,"disp":true,"width":"10","collapse":false,"className":""},{"id":"fdfa5af28343e428","type":"ui_tab","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]

At the moment I have problems with the correct display of the results data:
Unfortunately it will displayed all company names and then all other data but not company-price-company-price for example. I tried to understand this description.
I was not able to find the correct way to display the data correctly.

In addition I would like to sort the merged file. For example i would like to sort the data by the price downwards. I have not an idea how can I do this...

Has someone an idea where can I find info for the mentioned topics (for example link or book)?
I am a newbie with node red and so I hope someone can help me to resolve the task.

Thank you in advance.

You will need to supply a more concise flow, I do not have time to work out where your issue is in 14+ nodes.

Supply an inject with the JSON going into the template node, the template node that is not working, and the expected output string for the input JSON supplied in the inject node.

Hello @E1cid,
Sorry for the late response.
Now I tried to do a more concise flow. I hope that now it is more understandable. Sorry for the confusion.

[{"id":"dc8c6104daacfdad","type":"function","z":"67e5e39e7b6a8e54","name":"set payload and headers","func":"msg.headers = {};\nmsg.headers = {\n};\n\n\nmsg.payload = {};\nmsg.payload = {\n    'region' : 9,\n    'province': 'RM',\n    'town' : 'Monterotondo',\n    'priceOrder':'desc', \n    'fuelType': '1-1',\n    'refuelingMode': 1\n};\n\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":410,"y":180,"wires":[["0b229e04dffbd53f"]]},{"id":"0b229e04dffbd53f","type":"http request","z":"67e5e39e7b6a8e54","name":"post to HttpBin","method":"POST","ret":"obj","paytoqs":"ignore","url":"https://carburanti.mise.gov.it/ospzApi/search/area","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":620,"y":180,"wires":[["98f66fe3a98660e7"]]},{"id":"779b1e0a3f21fc0f","type":"function","z":"67e5e39e7b6a8e54","name":"set payload and headers","func":"msg.headers = {};\nmsg.headers = {\n};\n\n\nmsg.payload = {};\nmsg.payload = {\n    'region' : 9,\n    'province': 'RM',\n    'town' : 'Agosta',\n    'priceOrder':'desc', \n    'fuelType': '1-1',\n    'refuelingMode': 1\n};\n\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":410,"y":280,"wires":[["238e50c49fef190c"]]},{"id":"238e50c49fef190c","type":"http request","z":"67e5e39e7b6a8e54","name":"post to HttpBin","method":"POST","ret":"obj","paytoqs":"ignore","url":"https://carburanti.mise.gov.it/ospzApi/search/area","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":620,"y":280,"wires":[["98f66fe3a98660e7"]]},{"id":"98f66fe3a98660e7","type":"join","z":"67e5e39e7b6a8e54","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"1","count":"0","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":830,"y":220,"wires":[["bf5481fba58c520f"]]},{"id":"40aa7268ba842f2e","type":"template","z":"67e5e39e7b6a8e54","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{{#payload}}\nName company: {{name}}\n-------------\n{{#fuels}}\nprice: {{price}}\nfuel: {{name}}\nisSelf: {{isSelf}}\n-------------\n{{/fuels}}\nDate and time: {{insertDate}}\n______________\n\n{{/payload}}\n{{^payload}}No Result for\nname: {{name}}\nfuelId: {{fuelId}}{{/payload}}\n\n\n","output":"str","x":1260,"y":220,"wires":[["dcb9c9027fa69ce7"]]},{"id":"dcb9c9027fa69ce7","type":"debug","z":"67e5e39e7b6a8e54","name":"debug 229","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1450,"y":220,"wires":[]},{"id":"bf5481fba58c520f","type":"change","z":"67e5e39e7b6a8e54","name":"","rules":[{"t":"set","p":"name","pt":"msg","to":"Gasolio","tot":"str"},{"t":"set","p":"fuelId","pt":"msg","to":"2","tot":"num"},{"t":"set","p":"isSelf","pt":"msg","to":"true","tot":"bool"},{"t":"set","p":"payload","pt":"msg","to":"($$.payload.results{\t       \"name\": $.name,\t       \"fuels\": [$.fuels[$.fuelId = $$.fuelId and $.name = $$.name and $.isSelf = $$.isSelf]],\t       \"insertDate\":$.insertDate\t   })","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1040,"y":220,"wires":[["40aa7268ba842f2e","e0c83561935641f9"]]},{"id":"e0c83561935641f9","type":"debug","z":"67e5e39e7b6a8e54","name":"debug 230","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1270,"y":280,"wires":[]},{"id":"d6b487d8909c4605","type":"inject","z":"67e5e39e7b6a8e54","name":"","props":[{"p":"payload"},{"p":"name","v":"Benzina","vt":"str"},{"p":"fuelId","v":"1","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"success\":true,\"center\":{\"lat\":88,\"lng\":99},\"results\":[{\"id\":8524,\"name\":\"Kkkk\",\"fuels\":[{\"id\":514,\"price\":1.871,\"name\":\"Be\",\"fuelId\":1,\"isSelf\":false},{\"id\":589,\"price\":1.879,\"name\":\"Be\",\"fuelId\":1,\"isSelf\":true},{\"id\":687,\"price\":1.719,\"name\":\"G\",\"fuelId\":2,\"isSelf\":false}],\"location\":{\"lat\":1587,\"lng\":1474},\"insertDate\":\"2023\",\"address\":\"test\",\"tk\":\"hello\"},{\"id\":24864,\"name\":\"aaaaaaaaaaaaa\",\"fuels\":[{\"id\":51455,\"price\":1.879,\"name\":\"Be\",\"fuelId\":1,\"isSelf\":true},{\"id\":9841,\"price\":1.719,\"name\":\"Ga\",\"fuelId\":2,\"isSelf\":true}],\"location\":{\"lat\":47,\"lng\":45},\"insertDate\":\"2023\",\"address\":\"hgjnn\",\"tk\":\"test\"}]}","payloadType":"json","x":150,"y":220,"wires":[["dc8c6104daacfdad","779b1e0a3f21fc0f"]]}]


The join node works correctly.

I would like to display the results like:
Company
Price
Company
Price

Like your first result.
Now I get all companies and then all prices. (look screenshot).
I don´t know why I get this result.


Unfortunately I don`t understand how I get to change the template node. With the manual of mustache I wasn´t able to do the modifactiones.
Where can I find information or documents to this topic?

Thanks in advance.

So i asked for json in an inject, you supplied a couple of http request. Now i think if you want help it is only polite to supply what the helper requested, and rduce the work they have to do to help you, maybe i don't want to make unneeded http requests, maybe i just cant for what ever reason.

I will help you once again, but next time anyone ask for something, think how can i make it easier for these people to help me, and respond to their requests or questions.

here is what you should of supplied, corrected for you

[{"id":"7d24194f84574c08","type":"inject","z":"b9860b4b9de8c8da","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[{\"success\":true,\"center\":{\"lat\":41.97953251171709,\"lng\":13.032264373016346},\"results\":[{\"id\":11810,\"name\":\"AGOSTA-VIA SUBLA CENSE KM.6\",\"fuels\":[{\"id\":54424805,\"price\":1.899,\"name\":\"Benzina\",\"fuelId\":1,\"isSelf\":true},{\"id\":54424806,\"price\":1.729,\"name\":\"Gasolio\",\"fuelId\":2,\"isSelf\":true},{\"id\":54424807,\"price\":2.029,\"name\":\"Hi-Q Diesel\",\"fuelId\":6,\"isSelf\":true},{\"id\":54424808,\"price\":2.199,\"name\":\"HiQ Perform+\",\"fuelId\":28,\"isSelf\":true}],\"location\":{\"lat\":41.97953251171709,\"lng\":13.032264373016346},\"insertDate\":\"2023-06-20T07:03:51+02:00\",\"address\":\"VIA SUBLA CENSE KM.6 S/N 00020 - AGOSTA RM\",\"brand\":\"Q8\"}]},{\"success\":true,\"center\":{\"lat\":42.06220282165148,\"lng\":12.610557592213357},\"results\":[{\"id\":12917,\"name\":\"TREVISAN ROBERTO\",\"fuels\":[{\"id\":54601460,\"price\":2.179,\"name\":\"Benzina\",\"fuelId\":1,\"isSelf\":false},{\"id\":54601459,\"price\":1.879,\"name\":\"Benzina\",\"fuelId\":1,\"isSelf\":true},{\"id\":54601458,\"price\":1.999,\"name\":\"Gasolio\",\"fuelId\":2,\"isSelf\":false},{\"id\":54601457,\"price\":1.699,\"name\":\"Gasolio\",\"fuelId\":2,\"isSelf\":true}],\"location\":{\"lat\":42.06312744588049,\"lng\":12.590307891368866},\"insertDate\":\"2023-06-23T15:42:13+02:00\",\"address\":\"VIA SALARIA KM. 23+330  00015 - MONTEROTONDO RM\",\"brand\":\"Api-Ip\"},{\"id\":11823,\"name\":\"MONTEROTONDO-VIA LEONARDO DA VINCI 25\",\"fuels\":[{\"id\":54622174,\"price\":1.859,\"name\":\"Benzina\",\"fuelId\":1,\"isSelf\":true},{\"id\":54622175,\"price\":1.699,\"name\":\"Gasolio\",\"fuelId\":2,\"isSelf\":true},{\"id\":54622176,\"price\":1.999,\"name\":\"Hi-Q Diesel\",\"fuelId\":6,\"isSelf\":true},{\"id\":54622177,\"price\":2.159,\"name\":\"HiQ Perform+\",\"fuelId\":28,\"isSelf\":true}],\"location\":{\"lat\":42.07473447662624,\"lng\":12.596212245368974},\"insertDate\":\"2023-06-24T07:05:09+02:00\",\"address\":\"VIA LEONARDO DA VINCI 25 00015 - MONTEROTONDO RM\",\"brand\":\"Q8\"},{\"id\":51457,\"name\":\"IP\",\"fuels\":[{\"id\":54681469,\"price\":1.849,\"name\":\"Benzina\",\"fuelId\":1,\"isSelf\":false},{\"id\":54681468,\"price\":1.849,\"name\":\"Benzina\",\"fuelId\":1,\"isSelf\":true},{\"id\":54681471,\"price\":1.699,\"name\":\"Gasolio\",\"fuelId\":2,\"isSelf\":false},{\"id\":54681470,\"price\":1.699,\"name\":\"Gasolio\",\"fuelId\":2,\"isSelf\":true},{\"id\":54681467,\"price\":0.719,\"name\":\"GPL\",\"fuelId\":4,\"isSelf\":false}],\"location\":{\"lat\":42.054144386972524,\"lng\":12.634397429824284},\"insertDate\":\"2023-06-26T08:13:10+02:00\",\"address\":\"VIA SANDRO PERTINI  20 00015 - MONTEROTONDO RM\",\"brand\":\"Api-Ip\"},{\"id\":52326,\"name\":\"A.P. FUEL MONTEROTONDO\",\"fuels\":[{\"id\":54602679,\"price\":1.965,\"name\":\"Benzina\",\"fuelId\":1,\"isSelf\":false},{\"id\":54602678,\"price\":1.845,\"name\":\"Benzina\",\"fuelId\":1,\"isSelf\":true},{\"id\":54602677,\"price\":1.795,\"name\":\"Gasolio\",\"fuelId\":2,\"isSelf\":false},{\"id\":54602676,\"price\":1.675,\"name\":\"Gasolio\",\"fuelId\":2,\"isSelf\":true}],\"location\":{\"lat\":42.04967116667672,\"lng\":12.612383841139243},\"insertDate\":\"2023-06-23T16:21:33+02:00\",\"address\":\"VIA DELLE FORNACI KM. 4+150 SNC 00015 - MONTEROTONDO RM\",\"brand\":\"PompeBianche\"},{\"id\":22874,\"name\":\"eni monterotondo\",\"fuels\":[{\"id\":54636980,\"price\":2.064,\"name\":\"Benzina\",\"fuelId\":1,\"isSelf\":false},{\"id\":54636979,\"price\":1.844,\"name\":\"Benzina\",\"fuelId\":1,\"isSelf\":true},{\"id\":54636978,\"price\":1.914,\"name\":\"Gasolio\",\"fuelId\":2,\"isSelf\":false},{\"id\":54636977,\"price\":1.694,\"name\":\"Gasolio\",\"fuelId\":2,\"isSelf\":true},{\"id\":54636982,\"price\":2.014,\"name\":\"Blue Diesel\",\"fuelId\":20,\"isSelf\":false},{\"id\":54636981,\"price\":1.794,\"name\":\"Blue Diesel\",\"fuelId\":20,\"isSelf\":true}],\"location\":{\"lat\":42.06099852084146,\"lng\":12.586717754602432},\"insertDate\":\"2023-06-24T11:48:54+02:00\",\"address\":\"VIA SALARIA KM. 22,950 SNC 00015 - MONTEROTONDO RM\",\"brand\":\"AgipEni\"},{\"id\":6657,\"name\":\"MONTEROTONDO VIA FILIPPO TURATI 101\",\"fuels\":[{\"id\":54614662,\"price\":1.829,\"name\":\"Benzina\",\"fuelId\":1,\"isSelf\":true},{\"id\":54614663,\"price\":1.679,\"name\":\"Gasolio\",\"fuelId\":2,\"isSelf\":true}],\"location\":{\"lat\":42.06103257306434,\"lng\":12.599813640117645},\"insertDate\":\"2023-06-24T01:02:45+02:00\",\"address\":\"VIA FILIPPO TURATI 101 00016 - MONTEROTONDO RM\",\"brand\":\"Q8\"},{\"id\":35156,\"name\":\"AREA COFFEE\",\"fuels\":[{\"id\":52990297,\"price\":1.999,\"name\":\"Benzina\",\"fuelId\":1,\"isSelf\":false},{\"id\":52990296,\"price\":1.799,\"name\":\"Benzina\",\"fuelId\":1,\"isSelf\":true},{\"id\":52990299,\"price\":1.859,\"name\":\"Gasolio\",\"fuelId\":2,\"isSelf\":false},{\"id\":52990298,\"price\":1.659,\"name\":\"Gasolio\",\"fuelId\":2,\"isSelf\":true},{\"id\":52990300,\"price\":0.769,\"name\":\"GPL\",\"fuelId\":4,\"isSelf\":false},{\"id\":52990301,\"price\":2.289,\"name\":\"Hi-Q Diesel\",\"fuelId\":6,\"isSelf\":false}],\"location\":{\"lat\":42.06386561323193,\"lng\":12.629591524600983},\"insertDate\":\"2023-05-16T07:01:35+02:00\",\"address\":\"VIA EINAUDI KM 2,400 00015 - MONTEROTONDO RM\",\"brand\":\"Q8\"}]}]","payloadType":"json","x":350,"y":4720,"wires":[["bf5481fba58c520f"]]},{"id":"bf5481fba58c520f","type":"change","z":"b9860b4b9de8c8da","name":"","rules":[{"t":"set","p":"name","pt":"msg","to":"Gasolio","tot":"str"},{"t":"set","p":"fuelId","pt":"msg","to":"2","tot":"num"},{"t":"set","p":"isSelf","pt":"msg","to":"true","tot":"bool"},{"t":"set","p":"payload","pt":"msg","to":"$$.payload[*].results.{\t       \"name\": $.name,\t       \"fuels\": [$.fuels[$.fuelId = $$.fuelId and $.name = $$.name and $.isSelf = $$.isSelf]],\t       \"insertDate\":$.insertDate\t   }","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":560,"y":4680,"wires":[["40aa7268ba842f2e","e0c83561935641f9"]]},{"id":"40aa7268ba842f2e","type":"template","z":"b9860b4b9de8c8da","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{{#payload}}\nName company: {{name}}\n-------------\n{{#fuels}}\nprice: {{price}}\n-------------\n{{/fuels}}\n\n{{/payload}}\n{{^payload}}No Result for\nname: {{name}}\nfuelId: {{fuelId}}{{/payload}}\n\n\n","output":"str","x":780,"y":4680,"wires":[["dcb9c9027fa69ce7"]]},{"id":"e0c83561935641f9","type":"debug","z":"b9860b4b9de8c8da","name":"debug 230","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":710,"y":4740,"wires":[]},{"id":"dcb9c9027fa69ce7","type":"debug","z":"b9860b4b9de8c8da","name":"debug 229","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":870,"y":4640,"wires":[]}]

The inject hold the result of your join. This is helpful as we are now talking about a set of data that can not change, unlike http request which may result in a different data set each time.

1 Like

@E1cid ,
Thank you for your helpfulness!!!
I tried to do a more concise but I wasn´t sure if you need all the node to understand more detailed the initial situation. Now I understand that for you it was just understandable.
Learned something again.
Now I will try to understand how do you it done.
Thank you for your patience!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.