Mapping array with key-value pairs into a string

I’m trying to map the atAGlanceFacts array and format the results as a single string using the set variable module:

Type: Townhouse, Year Built: 2002, Heating: Central, Cooling: Central Air, Parking: 2 Attached Garage spaces, HOA: $520 monthly, Lot: empty, Days on Zillow: 27 Days, Price/sqft: $546, Offer Review Date: empty

Here is what I have so far but it only outputs the fact values.

{{join(map(3.resoFacts.atAGlanceFacts; “factLabel” & ": " & if(“factValue” != “”; “factValue”; “empty”)); ", ")}}

      • Townhouse, 2002, Central, Central Air, 2 Attached Garage spaces, $520 monthly, , 27 Days, $546,

What am I doing wrong? Thanks!


1 Like

@seldomstatic, I am currently working on a solution. It would be helpful if you could provide some info about where this data is being retrieved from, because there may be a way to solve it alternatively if I could see your scenario or the relevant parts of it.

UPDATE: Solution
Here I have a trigger that mimics a similar structure you showed. The second image is the output I was able to achieve.


How To:

  1. As long as you can retrieve the variables for each of those bundles of data you can aggregate them into a string using the text aggregator module.

  2. Input your labels in the order you want them output and you should be good to go.

Let me know if you need help with anything else.

2 Likes

This is the output from the Apify module. The atAGlanceFacts array is in the resoFacts collection.

1 Like

Hi @seldomstatic

You can use text aggregator module to achieve this.


Output:

Best regards,

Msquare Automation
Platinum Partner of Make
@Msquare_Automation

1 Like

The text aggregator works great, thank you!

1 Like

Not sure why your original post was hidden but appreciate the update! The text aggregator works great.

1 Like

@seldomstatic sure thing! If I helped with the solution it would be a great help to me to mark it as a solution for my credibility in the community. No problem if you are unable.

1 Like