Possibility of using get() function combined with join()

Hi everyone,

I’m trying to pull data from Quickbooks Timesheets and the data deeply nested in collections, no array anywhere.

What I need is the “id” for every project. I know you can use join(map()) in the scenario that there’s a high level array you can plug into however in my case I can’t. I’ve tried toArray on a higher level collection as suggested in a previous post but that doesn’t work. After everything I’ve tried the best I can do is this

which gives one individual id. is there a way to generalise the above equation? or is there a way to loop with get() without spending too many operations?

Thank you all

get only returns a single item.

I think you want to use map on an array, but projects is a collection.

You can use the built-in function toArray to convert a collection into an array.

e.g.:

{{ toArray(24.results) }}

Once you have an array, then you can use join.

For more information, see

Links

Here are some useful links and guides you can use to learn more on how to use the Make platform, apps, and app modules. I found these useful when I was learning Make, and hope they might benefit you too —

General

Help Center Basics

2 Likes

Hi @kabelk

Please try with the below method. This will result project ids separated by comma. If you want in array simply use map.
{{join(map(toArray(2.results.projects); “key”); “,”)}}

Input:



Output

If you require additional assistance, please don’t hesitate to reach out to us.
MSquare Support
Visit us here
Youtube Channel

3 Likes

Hi @Msquare_Automation

Thank you so much for your help. I really appreciate it. That formula is correct but it didn’t work for me, but it definitely has to do with the data:

My thinking is that the “linked_objects” object is interfering with toArray(). No matter what I try, when using myArray() the scenario returns an empty object. I don’t even have access to the key. Probably when using “2.results.id” cannot have anything nested in it.

Perhaps this is more of an issue for support.

Appreciate your help though!

hi @kabelk
To obtain the ID, you can utilize the following approach:
{{join(map(toArray(2.results.projects); “key.id”); “,”)}}

for the previous one we got the key value which is same as the id

if you can share the json structure ,we can assist you further.

2 Likes