Converting Array Collection into Plain Text: A Guide for Make.com Users

Have you ever found yourself stuck trying to convert an array collection into plain text? You're not alone. This is a common challenge faced by many Make.com users. In this article, we'll walk you through a step-by-step solution to this problem.

The Problem

Let's say you have an array collection like this:

[{“array”: [{“from”: “user”, “content”:c”, “timestamp”: “2023-08-08T13:31:10.844Z”}, {“from”: “operator”, “content”: “c”, “timestamp”: “2023-08-08T13:36:59.366Z”}, {“from”: “operator”, “content”: “c”, “timestamp”: “2023-08-09T09:55:32.154Z”}, {“from”: “operator”, “content”: {“namespace”: “state:resolved”}, “timestamp”: “2023-08-09T09:55:34.756Z”}, {“from”: “user”, “content”: “c”, “timestamp”: “2023-08-10T07:21:54.891Z”}], “IMTAGGLENGTH”: 5 }]

You want to convert this array into a simple long text string like “From: User, content: c, timestamp, …” to pass on to OpenAI. You've tried using the flatten() function, but it doesn't seem to work. So, what can you do?

The Solution

The solution is to use an iterator after your array aggregator and map the aggregator’s output to the iterator. This will give you the operator, content, and timestamp as mappable variables. Here's how you can do it:

  1. Get message results.
  2. Aggregate multiple messages into one element.
  3. Use an iterator after the aggregator to map the aggregator’s output to the iterator.

However, if you want to get a single text output, you can transform the output to JSON. This will give you one text output that you can paste into OpenAI.

Troubleshooting Tips

If you're still having trouble, make sure you're using the iterator correctly. Remember, the iterator should come after the aggregator. Also, check your JSON transformation. If it's not working, there might be an issue with your syntax.

Conclusion

Converting an array collection into plain text can be a bit tricky, but with the right steps, it's definitely doable. Remember to use an iterator after your array aggregator and map the aggregator’s output to the iterator. And if you want a single text output, don't forget to transform the output to JSON. Happy coding!

You do have further questions?

Ask your question via E-Mail: Richard@make-app.de
Book a paid Support & Consulting Session
New Make.com user? Sign up through this Affiliate Link to receive 10.000 operations for FREE.