Survey123 & Integromat

1738
9
Jump to solution
02-13-2020 01:35 PM
by Anonymous User
Not applicable

Hello,

I am wondering if anyone could help me figure out some issues I am having with Integromat and Survey123 data.

Issue #1: I need up to 12 photos to pass from survey123 through integromat and be placed / named in a google drive folder. I have a scenario that can do that for each photo individually (creating 12 mirrored branches one for each photo), while it works I feel that it could be a more streamlined flow that would pull all the photos in a batch. That is, instead of 12 individual branches producing 12 individual packages, I would like one branch with one package or at least the 12 branches converging to one group package. I hope that is clear. 

Issue #2: This issue is a bit smaller, Survey123 passes a record time/date as EPOCH aka UNIX timecode. I would like to pass the timestamp for my survey through integromat into a google sheets row. I have tried using the format date function in integromat but I cannot get the date/time to come into google sheets like 12/1/2020 12:05 PM. Oddly the format data function works perfect when I move the photos and put the time stamp (converted) into the title of the photo, but the exact same function using the exact same data does not work going into google sheets. 

Any help would be greatly appreciated

Thanks 

1 Solution

Accepted Solutions
Jim-Moore
Esri Regular Contributor

Hi Michael

The Iterator module essentially repeats everything downstream of it for each item in an array. If you provide the Iterator an array of URLs, it will pass them one by one (regardless of the number of URLs) to the HTTP module, and the HTTP module will execute once for each URL.

In my example above, I was using the data structure in the Parse JSON module to pull out the 'url' part of the attachmentInfos array. However, you can accomplish this in less steps (without the JSON modules), by using the map() array function inside the Iterator:


Your scenario might then look something like:

The Integromat help on mapping has useful info on arrays, bundles, etc. An error handler might come in handy for the case where there are zero attachments, if you want something different to happen in this case. See the Integromat help on error handling.

Hope this is useful.

Best,

Jim

View solution in original post

9 Replies
Jim-Moore
Esri Regular Contributor

Hi Michael

For issue #1, you could use an Iterator (one of Integromat's Flow Control tools) to process the attachments. There are probably a few different ways to accomplish this, but your scenario could look something like this:

In this example: transform the attachmentInfos object to JSON, then parse the JSON to get the attachment URLs. Pass these to the Iterator and then onto the HTTP Get a file and upload to Drive modules. In the screenshot you can see the Iterator has processed three attachments.

For issue #2, I was able to pass the date & time to Google Sheets using Integromat's formatDate function. If you want to display in 12-hour time, altering the custom number format in Google Sheets itself to dd/mm/yyyy hh:mm AM/PM should work.

Hope this helps.

Best,

Jim

by Anonymous User
Not applicable

Hi Jim,

Thanks for responding to my questions. Your suggested workflow for integromat makes a lot of since, I am having a few issues getting it to work correctly. My first issue is that my survey does not require all 12 photos, so there are surveys that only have a few photos and some that have all 12. Right not when there are missing photos my scenario breaks, I feel like I could use a something like a if then statement but may need suggestions. If I can get past having or not having all 12 photos my next step would be making the 'get file' get more than one file. So far I have only been able to get one file. Again I appreciate the help.

Thanks

0 Kudos
Jim-Moore
Esri Regular Contributor

Hi Michael

The Iterator module essentially repeats everything downstream of it for each item in an array. If you provide the Iterator an array of URLs, it will pass them one by one (regardless of the number of URLs) to the HTTP module, and the HTTP module will execute once for each URL.

In my example above, I was using the data structure in the Parse JSON module to pull out the 'url' part of the attachmentInfos array. However, you can accomplish this in less steps (without the JSON modules), by using the map() array function inside the Iterator:


Your scenario might then look something like:

The Integromat help on mapping has useful info on arrays, bundles, etc. An error handler might come in handy for the case where there are zero attachments, if you want something different to happen in this case. See the Integromat help on error handling.

Hope this is useful.

Best,

Jim

by Anonymous User
Not applicable

Thank you Jim Moore

This is exactly what I was looking for. I have one more question for you. My new iterator array with all the attachment URLs also includes the signature URL from my survey. I would like to filter/remove the signature URL from the array as i do not need it in my google drive. I have tried using a filter before and after the iterator module but only got errors. I tried to use a few different "if' or "and" statements In the iterator to ignore the signature URL but still errors. 

Again I really appreciate the help.

0 Kudos
JamesTedrick
Esri Esteemed Contributor

Hi Michael,

You should be able to use a filter after the download based on the name of the signature question, which is the beginning of the file name of the image.

by Anonymous User
Not applicable

James,

I am not sure I know what you mean, every filter I have tried gives me errors, and I am having torible getting the ignore function to work, in any filter. Do you have any examples?

Thanks

0 Kudos
Jim-Moore
Esri Regular Contributor

Hi Michael

As James Tedrick mentioned, the file name for an image question's attachment (including signatures) starts with the question's name. For example, if your signature question is called "signature1" you'll get an attachment that looks something like "signature1-7d9b665a20f647d1aypd7fb884cded34.jpg". Your filter could like this:

This filter would go after the HTTP (Get a file) module.

Cheers,

Jim

0 Kudos
UTAHOGM_GIS
New Contributor II

Hi Jim,

I am back with a similar issue except that this time I am using a survey that utilizes the repeat function to allow a survey to have unlimited photos attached. I tried using the scenario you helped me with above but the issue is that in the "attributeinfos" in this survey only has the signature photo URL. The URL for the photos is in the "repeats" section under features.

 

If you have any suggestions I would appreciate it.

0 Kudos
PaulSweeney3
Occasional Contributor II

@UTAHOGM_GIS  You need to use an iterator on the repeat.  The repeat is basically an array of items,  when you use an iterator and specify the repeat section of your form as the value it will allow you to map the fields in the repeat further along on your scenario and it will run for each repeat

0 Kudos