Transfer a PDF file from Nanonets to Airtable through Make

The scenario I’m working on has invoice data be transferred from Nanonets (an OCR tool) onto Airtable. The invoices at hand are invoices whose amounts are due to services providers. The scenario on Make is triggered whenever an invoice data mapping is approved by a user on Nanonets.

I expect the scenario to retrieve the invoice PDF file from Nanonets and to upload it onto Airtable.

The thing is, the ‘Invoice’ field that’s supposed to store the transferred invoices on Airtable is empty for each new record that gets created upon each data transfer.

I believe the problem is due to the value I populate in the ‘File URL’ field in the Airtable module. The value I fill it in with is {{1.result.signed_urls.uploadedfiles/9aeb90c3-ca3d-46e3-809d-891a747857b2/RawPredictions/e452c789-dea1-40c0-96d8-21d0d5bb3f28.pdf.original}} (see attachment below).

But as I can see once the scenario has run, this value is in white instead of being in red, indicating that this value no longer exists (see attachment below). I suppose that happens because the name of the part uploadedfiles/9aeb90c3-ca3d-46e3-809d-891a747857b2/RawPredictions/e452c789-dea1-40c0-96d8-21d0d5bb3f28.pdf changes at each automation run.

Did I identify correctly the root of the problem? How to circumvent this? For reference, you’ll find below the description of the webhook output at the beginning of the scenario.


Any help would be much appreciated.

Hi @JBJ, hope you are doing well.

Before trying to map the url directly in Airtable, you can use an ‘iterator’ module (second step) to iterate through all the items under ‘signed_urls’ to get all the items as separate bundles, so you can then map the desired url in the Airtable. (3rd step)

This is incorrect. The variable result.signed_urls is not an array, and it cannot be iterated.

samliewrequest private consultation

Join the Make Fans Discord server to chat with other makers!

Thank you @samliew. I am also learning and trying to help at the same time.

Can we use toArray() function in a set variable to get the collection as array then would be able to map the required field. Or any other way around?

By the way @samliew I have already joined the discord server of yours.

1 Like

Yes that’s the first step.

Next, once we have an iterator outputting multiple bundles, we can simplify the mapping into the Airtable files field using the following trick:

Every result (item/record) from a search/match module will output a bundle. To “combine” them into a single structure, you’ll need to use an aggregator of some sort.

Aggregators are modules that accumulate multiple bundles into one single bundle. An example of a commonly-used aggregator module is the Array aggregator module. The next popular aggregator is the Text Aggregator which is very flexible and has applies to many use-cases.

Read This

The Array Aggregator module allows you to build a complex array of collections for a later module’s field to map multiple items (collections) to it.

Here is an example of using the “Target structure type” of an Array Aggregator module:

As you can see, the “Map” toggle on fields are used when you have an array. You can easily build an array variable to map to a field, by using an Array Aggregator module and select the “Target Structure Type” as the future field you want to map the array into.

samliewrequest private consultation

Join the Make Fans Discord server to chat with other makers!

1 Like

Thank you @samliew. Hopefully @JBJ can solve the problem by following this.
Take care

@KaziGoni and @samliew, thank you for your help and reactivity! :grinning:

I do have remaining questions to solve this problem, though. I should first confess that I’m brand new to Make. So my questions may sound elementary to you guys.

  1. As of now, to be able to know whether a group of elements is an array or a collection, I first run the scenario on Make and then send data to it, which allows me to get an output description as the one just below. But that forces me to send data and run the scenario every time I just want to know the nature of a group of elements. Is there any other way to know this?

  1. Why are arrays sometimes displayed in a single block and sometimes in two separate blocks?


  1. Why is it necessary to first transform the collection result.signed_urls into an array? Is it because only arrays can be mapped?

  2. Why do I need to have an Aggregator module set up after the toArray function is performed since: a. I got only 1 array in my output bundle (Signed_URLs_1) and not multiple objects, b. in the end I want to retrieve only one value (the URL of the PDF file, an invoice) and not an aggregation of values?

Attachment #4

  1. Finally, how do I map the original value I’m interested in in the Airtable module?

Hi @JBJ hope you are doing well.

Please have a look into these 3 videos by Make to understand Iterator, Array Aggregator better with an example scenario. It will definitely help you in this situation. I was just watching them and they are great.

Part1:

Part2:

Part3:

Note:
You can use another iterator to iterate through the newly created array ‘signed_URLs_1’ to get the each collection inside it as different bundles.

Then you can use an aggregator to create an array from that bundle of specific item e.g. value. It will simplify the mapping in the next step.

Of course you can use functions to shorten the steps but that is where I am not still very capable of guide you. You can discover array functions as well.

Please watch the above videos. You are very close to the destination.
Best of luck

1 Like

@KaziGoni Thanks for the links and your help!

@samliew Thank you for the explanation!

After iterating (pun intended) dozens and dozens of times, I finally managed to have the second PDF file be automatically uploaded onto Airtable. You guys helped me a lot.

Hi @JBJ nice to hear that you have done it at last. Best of luck

2 Likes