Question

Array data is automatically concatenated

  • 27 January 2022
  • 4 replies
  • 250 views

 

Hello,

I tried a lot of solutions by myself but I’m facing a blocking issue.

Step 1 (trigger)

When I get a notification on a webhook, I launch the Step 2

Step 2

I run a GET request on an API and get these results below with a business open hours

 

Step 3 (here is my issue)

I want to copy paste all results from the GET request in different lines of a Google Sheet. I’m using the “Create Spreadsheet Row(s) in Google Sheets”

It’s working fine for all fields except for the hours which are concatenated between businesses (see below) 🥺

 

I would like to have the correct hours for each businesses instead of this concatenation.

How do you think I can manage it?

 

Thanks


This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

4 replies

Userlevel 7
Badge +14

Hi @Svn 

There are some challenges to overcome while working with this data.

There are multiple line items returned for the GET request.

 

Arrays are defaulted to be comma separated.

However, the Hours for each Business include a comma (e.g. Thursday, 11am to 2am)

 

That may require using an advanced Code step to encode then decode certain values in order to properly work with the Hours data.

 

You can try using Formatter > Utilities > Line Items:

 

Thanks @Troy Tessalone but I’m stuck with the Line Items because all data is sent at the same place and I can’t define from which business the open hours are coming from 🥺

Userlevel 7
Badge +14

@Svn

That’s where a Code step would be used to add in advanced parsing logic.

This involves iterating over the nested data and parsing the data.

Each Business has 7 Days of Hours.

So if there are 3 Business results, there would be 21 Hours returned.

The first set of 7 Hours would be for the first Business, and so on.

Userlevel 7
Badge +14

@Svn 

One thing to try would be to limit the results in Step 2 (GET) to only return 1 result.

If you need to get multiple results from the GET, then consider running the GET multiple times using the Looping app: https://zapier.com/apps/looping/integrations