Skip navigation
All Places > Survey123 for ArcGIS > Blog > 2019 > November
2019
Check out Part 1 and Part 2 of the series.

In the final part of this series we'll see how to set up an email template for our webhook containing dynamic elements from the survey data and where to access additional webhook settings.

 

The steps below build on the webhook started in Part 1 & 2 but can be applied to any other webhook.

1.  Click on Add an action under 'Convert time zone' of the If yes branch of your condition.No alt text provided for this image
2.   Search for ‘send an email’ and select the action from the result list. No alt text provided for this image
3.   Complete the To and Subject fields (you should be able to search for your O365 contacts). No alt text provided for this image

4.   Compose the message

 

What formats and options do we have to include different content? By default, your message is sent as plain text - no hyperlinks or bold/coloured text, but you can include dynamic content like your converted time and values from your submitted survey data. What if you want more?

 

At the bottom left of the Send an email step, there is an option called Show advanced options. Hidden here you have the availability to switch your email format to HTML (and include HTML formatting tags to change the look of your email), send the email on behalf of someone else, add attachments, set CC and BCC recipients, set the importance of your message and so on.
No alt text provided for this image
That's general formatting out of the way, so we can now focus on including dynamic content in our message template. The following example will add a hyperlink to a web map that will show the location of the reported close call when it's clicked on. We will use a web map application that is shared with the relevant AGOL group(s), thus notified people can see the reported close call in a map.

 

The web map application to use may contain many other layers and we only want to show the one that contains the survey data and want to zoom in onto the close call location. How do we do this? Documentation to the rescue! The online help for Web AppBuilder for ArcGIS has a section about using URL parameters - we just need to have a look at the following sections:
  • Open a saved app
  • Set layer's visibility
  • Query a feature

 

Using the information from the help we can construct the url:

 

https://<your portal url>/apps/webappviewer/index.html?id=<itemId>&showLayers=<layerID>&query=<layerID>,<queryField>,<queryValue>


Where to find the values required?
  • itemId: Open the item's page in AGOL and look at the end of the URL in your web browser or scroll down to URL on the item's page and copy the hash value.

 

No alt text provided for this image

 

  • queryField: this is the field from your layer to use for the query. (We use the OBJECTID in our example.)

 

  • queryValue: value coming from your survey data, so your link is dynamic and will work with any close calls. (For testing purposes you can use a static value.)

 

It is highly recommended to test your URL in a web browser to make sure your web map application loads with the layers you need and shows the queried feature. It would look something like this:

 

https://XXXXXXXX.maps.arcgis.com/apps/webappviewer/index.html?id=a0b000c00d0e0ff0gh000iiij0kkl00f&showLayers=service_00a0b00000c00000d000e0f0g0000h0i_0123&query=service_00a0b00000c00000d000e0f0g0000h0i_0123,OBJECTID,95 

 

Once the URL is tested and you are happy with the results, it can go in to the email message with the rest of the dynamic content (change to 'Yes' under Is HTML first in advanced options). An example can be seen below.

 

No alt text provided for this image

 

The sent email would look like this: 

 

No alt text provided for this image

 

Clicking on the hyperlink opens the web map application, pans to the feature and displays a pop-up:

No alt text provided for this image

 

With using dynamic content in custom functions in the body of your message you can create a template that could be dynamically updated with the correct close call reason for example: No alt text provided for this image

 

Additional webhook settings on the Survey123 website

Most of your webhook settings can be controlled in your Power Automate (aka MS Flow) account, but there are a few settings that can only be accessed on the Survey123 website.

 

1.  Open your web browser and go to https://survey123.arcgis.com

 

2.  Log in and find the survey with the webhook in question

 

3.  Click on the ellipsis (...) button and select Settings

No alt text provided for this image

4.  Click on Webhooks on the left-hand side to see all webhooks for your survey

 

5.  Click on Edit (the pencil icon) under Operations to see more details No alt text provided for this image

6.  On the new page you can make changes to your webhook:

  • Edit its name
  • Change when it should be triggered: new records submitted, existing records edited
  • Event data: information included in the payload. Hover over the grey '?' icon after each item to see the information they include
  • Turn the webhook off or back on

 

No alt text provided for this image

NB: Changing the payload URL can break your webhook, only do it if you are sure you know what you're doing.

 

Summary

In this series of articles you learnt how to

  • Create a new webhook in Power Automate (MS Flow) for a Survey123 survey
  • Add conditions, convert and format the survey time
  • Send a notification email with dynamic content as part of the webhook
  • Find additional settings for your webhook

 

I hope you enjoyed the series! Feel free to share the articles with your network, leave feedback or message. 

You can download the article series in PDF format from here.

In this blog post I will explore a handful of XLSForm techniques to help you better control the organization and layout of questions within a form. You will learn about groups, grids and pages, but also other tricks to refine the size, placement and look and feel of questions within your form.

 

--------------Groups--------------


Groups: XLSForm Basics


Groups organize questions into sections, helping users more easily navigate complex forms.Our Survey123 for ArcGIS: Using Groups to split your survey into sections - YouTube  video is about the quickest way there is to learn the basics of XLSForm groups. I strongly suggest you watch it, it's only 2 minutes long.

 

 

As described in the video, you can create sections in your form by enclosing a set of questions within a begin group/end group block. You need to specify a value in the name column of the begin group row, and this name must be unique. If it helps you navigate the spreadsheet, you can also add a name to the end group row, but it is not compulsory.

 

nametypelabel
texthh_idHousehold ID
begin grouphh_groupBasic Household Information
geopointhh_locationGPS Location
hiddenhh_location_acHorizontal Accuracy
texthh_addressAddress
end group

 

You can add as many groups as you like to a form, and you can nest them too: you can add groups within groups!

                

On occasion, you may want to display groups collapsed and let the end-user expand them if needed. This can be achieved by setting the appearance column to compact.

 

It is not possible to dynamically expand or collapse a group with an XLSForm expression.

Use the compact appearance to make your group appear collapsed by default.

              

 

Formatting Group Headers

 

Since groups are fundamentally used to help users navigate long surveys, it is important to take pride in the headers. The group headers, if formatted appropriately, can really make a big difference for people.


The font of group labels by default is a bit bigger and bolder than the labels of questions. This helps the group header stand out. Using HMTL formatting within the label column of the begin group row, you can bring your own style to the group header. For example, you can center the label in the screen, change its color, and size.

 

In the example to the right, the group headers have been given different background colors to help users navigate more quickly between them. Note that the first two groups, in red and blue, are collapsed but users can choose to expand them.

 

The Style your survey—Survey123 for ArcGIS | Documentation help topic shows the most common HTML tags that you can use to format your labels. When setting colors, you can use either their HTML code name or their hexadecimal representation. At W3Schools you can use the handy color picker for HTML colors. All the properties described in the documentation are supported in the Survey123 mobile and web apps except for the background color, which is only supported in the field app. 

 

The next XLSForm sample shows the syntax for defining the background color of the group header.

 

Body bgcolor is only supported in the field app. Webforms will ignore this property.

              

 

nametypelabel
texthh_idHousehold ID
begin grouphh_group<body bgcolor="#C00000"><font color="white">Household Information</font></body>
geopointhh_locGPS Location
hiddenhh_loc_acHorizontal Accuracy
texthh_addrAddress
end group

 

Dynamic Labels for your Groups

 

When working with labels for your groups (and questions, actually), remember that on top of the formatting syntax described above, you can also dynamically change the label content. For example, say you have a health household interview survey where we you need to capture all symptoms detected in each of the household members. You can present the symptoms group with a label that matches the name of the household member for which you are capturing the data. This could help eliminate confusion. Below is the actual example. Look how the group header in black changes depending on the household member name entered.

 

 

Check out Understanding Dynamic Labels in Survey123 for ArcGIS to learn more about this technique.

 

Visibility of Groups


One final note on groups relates to their visibility within the survey, which is controlled through the relevant XLSForm column. If an expression written in the relevant columns evaluates to true, the group is shown, otherwise it is hidden to the user. 

 

A common bad practice with form design consists on repeating the same relevant statement to a large collection of consecutive questions. This slows down your survey, because the same expression needs to be evaluated again and again for each of the questions. If a sequential set of questions shares the same relevant statement, it is good practice to group them and apply the relevant expression to the begin group row only. If the group is relevant, all questions within the group will show. If the group is not relevant, all questions inside the group will be hidden. There is no need to duplicate the relevant expression again and again.

 

--------------Pages--------------

 

Introduction to Pages

 

Pages are particularly useful when working with large forms, helping you logically organize your questions and giving end users a sense of progress across the entire survey.


Even for smaller surveys, pages can be useful. In the example below we have a Special-Use application permit form.  I added a welcome image and text on the first page to create a cover for the form. Note that the first page does not expect any input from the user. It is just a welcome page, or cover page to the survey. Next, I organized the actual questions within my form into pages, giving each page a descriptive title at the top. As users move from page to page, a progress bar at the bottom shows how close they are to the end of the survey.

 

 

In the Survey123 field app, users can easily move through pages in the form one by one. Alternatively, a page menu lets users jump to any of the pages in the form with a simple selection. In the example shown below, the page menu helps the user jump from page 3 to 32 with just a couple of taps.

 

 

Pages: XLSForm basics

 

If you want to add pages into your form, firstly you need to set the style of your XLSForm to pages. This is done through the settings XLSForm worksheet as shown below.

 

form_titleform_idinstance_namesubmission_urlstyle
Zika Household Surveypages

 

Once the style is set, add one group for every page you want and set the appearance of the group to table-list. For example

 

nametypelabelappearance
texthh_idHousehold ID
begin grouphh_groupHousehold Informationtable-list
geopointhh_locGPS Location
hiddenhh_loc_acHorizontal Accuracy
texthh_addrAddress
end group

 

When working with the pages style, it is good practice to have all questions within a page. That is: make sure all your questions in the form are within an existing group with an appearance set to table-list. If you leave questions outside of a page, you will get erratic behavior across the web and field apps where a single question may appear on every page.

 

You can combine groups and pages. That is, you can include groups within a page. Groups do not become pages unless you set their appearance to table-list.

 

All the header HTML formatting tricks described for groups above, also apply to pages. The same goes for the behavior with the relevant expressions. You can hide pages by using relevant statements, however keep in mind that the behavior across the web and field app is different. In the web app, non-relevant pages will be truly hidden, you will not even see them in the page navigator controls. This will cause the total count of pages in the page navigation control to vary as pages become visible or hidden. In the case of the field app, as of version 3.7, the pages will still show in the page navigation control, but will be shown blank. This is a known issue (BUG) in the field app.

Hidden (non-relevant) pages in the field app will be shown blank. This is a known issue as of version 3.7.

                

 

--------------Grids--------------

 

Grids: Introduction


Typically, questions within a form are arranged to take the full width of the screen. It is possible however to arrange multiple questions side by side using custom grids (theme-grid in XLSForm jargon). This is particularly useful when you are designing a form for use on a tablet.

 

With this type of grid layout, you can maximize the number of questions shown within the width of screen, reducing the need for users to scroll up and down. Grids can also help you mimic more closely the look and feel of legacy paper forms. Copying the layout of paper forms is not necessarily a good idea, but in some cases achieving some level of resemblance can make nostalgic users happier.

 

In the example shown to the right, you can see how questions can be arranged side by side. Crafting such a survey, defining exactly the placement of questions takes some thought and trial and error, but the experience it provides to the end user is significantly better than with a regular layout. This type of design is generally put together with a specific form factor in mind. That is, you design your survey for a particular minimum screen size. If a grid design like the one shown is loaded in a smart phone, the form is not going to look right. I have seen some people creating two flavors of the same survey: one for tablets and one for smart phones.  It clearly adds an overhead during design, but if your survey questions are not going to change much it is a good thing to consider.

 

The theme-grid style is not supported in the web form. It is only supported in Survey123 Connect and field app.

          

 

Grids: XLSForm Basics

 

To arrange questions in a grid layout, you first need to set the style of your survey to theme-grid. This is done in the settings sheet of your XLSForm.

 

form_titleform_idinstance_namesubmission_urlstyle
My Surveytheme-grid

 

Once the theme-grid is set, all groups within your survey will contain questions using a four-column grid layout. You can change the number of columns in a grid by simply adding the w (as in width) property to the appearance column of your group. For example, w2 means two columns, w8 means eight columns.

 

nametypelabelappearance
texthh_idHousehold ID
begin grouphh_groupHousehold Informationw2
geopointhh_locGPS Location
hiddenhh_addrAddress
texthh_cityCity
texthh_zipZIP Code
end group

 

Unless specified otherwise, questions within a group will always take one column of the grid. In the example above, the GPS Location and Address will be placed side by side in one row, and the City and ZIP Code will complete a second row.

 

Using the w property for the individual questions within the group, you can choose how many columns you want each question to take. In the example below, I gave two columns (one full row, since the grid has two columns) to the GPS Location question, and another full row (two columns) to the address. I then arranged the City and ZIP Code questions side by side giving them a w1 appearance.

 

nametypelabelappearance
texthh_idHousehold ID
begin grouphh_groupHousehold Informationfield-list w2
geopointhh_locGPS Locationw2
hiddenhh_addrAddressw2
texthh_cityCityw1
texthh_zipZIP Codew1
end group

 

 

You will also note in the screenshot above that the Household ID question is taking the full width of the screen. That is expected. When using the theme-grid, questions outside of a group always get rendered as usual, taking the full width of the screen.

 

Grids: A few extra tips and things you should know

 

  • Survey123 Connect includes a handy XLSForm sample called Grid Style Groups. It shows some advanced techniques, including arranging repeats and geopoint questions side by side, combining pages with grids, etc.

 

 

  • Working with grid layouts gives you a lot of flexibility, but mastering it takes time and trial and error. Always test your designs on a mobile device that you are targeting to make sure things look as you expect.
  • Do not expect the grid layout, or questions within a grid, to automatically adjust to the size of the screen. If you do not give enough space to your questions, they will look ugly. For example, in practice, you can't work with more than 2 columns on a smartphone. Even when working with 2 columns you need to be careful when working on small screens: you need to keep the labels of questions and choices short and avoid question types like geopoint or dateTime which tend to take more space. Do not take this the wrong way, you can use 2 columns in a smart phone, but with caution.
  • I know I said this before, but I will say it again: the theme-grid is not supported in the webform. It is only supported in the Survey123 field app.
  • You can combine pages and grids. Simply set the style of your form as follows:

 

form_titleform_idinstance_namesubmission_urlstyle
My Surveytheme-grid pages

 

  • When using theme-grid, questions outside of a group (grid) will always take the full width of the screen.
  • If you do not define a width (w parameter) for a group, the number of columns in the grid will be four (as in w4)
  • If you do not define a width (w parameter) for a question within a group, it will default to w1.
  • Non-relevant questions will still take space in your layout. If a question is non-relevant, you will see an empty space in your grid.
  • Be careful with or_other. If you use a select question with the or_other option, your question will always take one extra cell (column). This is in anticipation that the end-user selects the 'other' choice. In that case, a new free text question appears, taking the extra space.
  • You cannot apply a width parameter to a repeat, but you can apply it to a group within a repeat.  If you want to learn how to arrange repeats side by side, have a look at the Grid Style Groups XLSForm sample in Survey123 Connect.
  • The table-list appearance does not work in combination with theme-grid or pages.
  • The body::esri:style XLSForm column can help you refine the height of questions. This can be useful, particularly when working with the theme-grid. For example, if you put a text and a geopoint question side by side, the layout will show unbalanced, because the text question by default is not as tall as a geopoint question. You can change the height of geopoint, geotrace, geoshape signature and multiline text questions. Learn more at Esri custom columns—Survey123 for ArcGIS | Documentation 

 

 

When using the body:esri:style column, keep in mind that some properties are not compatible with theme-grid. For example, borderColor is not supported (do you need border colors? If so Vote for this GeoNet idea), and repeats inside of grid style groups do not support backgroundColor either.

Part 1 of this article can be found here.

In Part 2 we'll have a look at how we can add the survey's time to the webhook and how to convert time zones and format the date/time string.

Add survey time to your notification email

Survey123 submits date and time from your survey form in UNIX format. This means that the date & time value will be in milliseconds. By default, you cannot really display this in any usable format unless you convert it first. There are many time converters available on the internet, like this one to do that. However, we don’t need to use these in Flow as we can set up a function for this.The steps below are based on the webhook we created in Part 1 - but can be applied to any existing or new webhook (assuming that your survey has a date/time field in it).

1.   Click on Add an action under the If yes branch of your condition No alt text provided for this image
2.   Search for ‘add to time’ and select the action from the result list.
No alt text provided for this image

3.   To edit the action, click into Base time and switch to the Expression tab in the context dialog:
No alt text provided for this image

4.   Enter the expression* into the function box (fx) and save your webhook:
addseconds('1970-1-1',div(triggerBody()?['feature']?['attributes']?['survey_datetime'],1000))

NB:
This example assumes that the date/time field in your survey is called 'survey_datetime'. If it's different in your survey, you need to modify the expression accordingly.

* I am aware that a similar expression exists in this blog article, but all the date formatting strings I've tried gave me an error in Flow. I believe Flow was updated since that article and no longer accepts the formatting string as part of the expression. When leaving the formatting string out, the expression was accepted and works just fine.

So, what does the above snippet do?

The addseconds() function adds the seconds specified to a base time. The base time for Unix is 1st January 1970, hence the '1970-1-1' part as base. Then in the second parameter we call the dynamic value from the ‘survey_datetime’ field – but as this is in milliseconds, we need to divide this by 1000 as the addseconds() function needs a value in seconds. That’s why we added the div() function, which provides this division for us.

 

You can add a static hour/day/month/etc. value to this calculation specifying the Interval and Time unit in the step. (For example if your device's clock is misconfigured.) We don't need to add anything in our case, so we just set it to '0 Hour'. 
No alt text provided for this image

Convert time zone and format string

As discussed above, your survey's date & time is submitted in UNIX format (also known as UNIX Epoch, UNIX timestamp or POSIX time) which starts at midnight (UTC) on 1st January 1970. If your local time zone is different from UTC, you may want to convert the calculated time into your correct time zone.

The below steps assume you have completed the time calculation step in the previous section.

1.   Click on Add an action under the If yes branch of your condition.
No alt text provided for this image
2.   Search for ‘convert time zone’ and select the action from the result list to add it to your flow. No alt text provided for this image
3.   Click into Base time, then in the Dynamic content tab of the context dialog select Calculated time – this is the function we just created in the top half of this article. No alt text provided for this image
4.   Set up the Source time zone (it must be UTC) and your Destination time zone, then choose a Format string you want to use. 
No alt text provided for this image

 

 

In Part 3 we will discuss how to include the calculated/converted time and other dynamic content in the notification email and where to find additional settings for your webhook.

Update: Microsoft recently renamed Flow to Power Automate - link.

 

Note: Creating webhooks in ArcGIS Enterprise was introduced in v10.7 and the authoring process in that environment is different and will be discussed in a future post.

 

Starting with Survey123 for ArcGIS 3.0, webhooks can be set up and activated when a survey response is submitted. What does this mean? Basically, when a survey is successfully submitted, different workflows can be triggered based on the content of the submission: sending notification emails, adding results to a spreadsheet and so on.

 

There are a wide variety of workflow services available, such as Power Automate (aka MS Flow), Integromat, tray.io, Zapier, IFTTT, n8n.io, CloudHQ and the list goes on. Most (if not all) of them can be used to incorporate Survey123 as a trigger to build your automated process. Out of these, Integromat and Power Automate have a Survey123 connector making it easier to implement your processes. This article guides through an example using Power Automate.

 

What will you need to create Survey123 webhooks?

  • ArcGIS Online (AGOL) Organisational account
  • Your Survey123 form published into AGOL
  • Office 365 account to access Power Automate

 

Below is a workflow for creating a webhook that triggers an alert email if the submitted data meets a condition (for example the weather is Adverse).

 

1.  Open Power Automate (go to your O365 account and search for the app), go to My flows and click on + New > Automated - from blank :

 

2.  Give your webhook a meaningful name, so you know which one to edit/disable later if needed when you have more of them.

 

3.  Search for ‘Survey123’ under Choose your flow’s trigger, select When survey response is submitted and log in to your AGOL account (you only need to log in once, the connection is stored in your Flow profile). No alt text provided for this image

 

4.  Select your survey from the drop-down and click on New StepNo alt text provided for this image

 

5.  Choose an action: for example ConditionNo alt text provided for this image

 

and add your survey field(s) and the value(s) you want the webhook to be triggered for. You can select your survey fields from the Dynamic content part for the condition: No alt text provided for this image

 

Under the If yes branch, add a new step (click on the ‘+’ sign) and search for Send an email (Outlook). Set up the required details and save your flow – use both Save buttons: one at the bottom and one in the top right corner! No alt text provided for this image

 

You should be able to see the webhook triggered on the webhook’s page under RunsNo alt text provided for this image

 

If you click on an item on the list, you can see the details of that run. You can use this to see if a run failed (and why). No alt text provided for this image

 

6.  Download your survey in the Survey123 app and test your trigger. If you downloaded the survey before the trigger was added, delete the survey and re-download it. Otherwise your webhooks won’t work.

 

In Part 2 we will discuss how to add the survey time to your webhook/flow and convert time zones.

 

For the 2019 Esri Southern African User Conference I challenged myself and looked for a solution to a requirement that one of our clients have.

In a nutshell the client wants a survey that follows a preset workflow, for this example we will create a solution for a workflow that involves inspections done at regular intervals when a house is being built.

 

Survey Worflow

Let's consider the following status values for a building inspection survey:

 

Here are some user requirements for this survey:

  • The initial status is always Excavation
  • The inspector should not be able to skip a status
  • The inspector can only move on to the next status in the chain, not backwards
  • Inspection questions for a specific status can only be edited when that status is the active status

 

How will we go about forcing this workflow in Survey123?

There are some hidden challenges in getting this to work. The biggest hurdle is that in Survey123 you cannot compare a field to it's own or previous value, so you cannot tell Survey123 the next status can only be Foundation when the current status is Excavation. This has lots of design implications and one would be tempted to stop looking for a solution right here. But this is where you need to think a little bit out of the box...

 

So how does the end result work? Lets take a look:

 

 

 

In the above screenshot the following can be seen:

  • The survey initialises with only the Excavation status being visible in the select_one question. The inspector is not able to select any other status.
  • The survey only has the Excavation Checklist enabled
  • The inspector cannot skip a status or go back to any other status
  • The inspector cannot complete any other checklist of the survey - only the active status' checklist

 

The Solution

 

Lets look at the bits and pieces to make this work:

 

We need a way to only allow the inspector to choose one "next" status and this needs to be based on the "current" status. So we need a select_one that is filtered according to the "current" status:


 

Notice that we added a filter column called "prevval" to the choices for the "level" list. In this example "level" refers to the status of the inspection. Also you will notice that the levels run from 1 to 6 and the corresponding "prevval" filter is one level behind. So if the "prevval" or current status is zero (0) then the list will filter and only show Excavation as an option.

 

Ok, time for the interesting part of this solution. Since we cannot filter the list called "level" with itself we need to find a way of retrieving the inspection status into a new variable. This is done by quering the current status value from field "status" from the feature layer with a JavaScript pulldata function:

We do the max function so that for newly created records we start with a level of zero(0) - the pulldata returns nothing since there isnt a record created yet to query so we convert it to a 0 with the max function.

 

Basically this is it! There are some other work to be done, such as writing the JavaScript file to query the data from your hosted Feature Layer. If there's enough interest I will post the source files after cleaning it up a bit.

The 2020 Esri International User Conference is still eight months away, but the deadline for submitting presentation abstracts is approaching fast in November 8!   You do not need to have a fully developed story to submit your paper. A brief abstract describing what you intend to present is plenty. We are looking for inspiring stories showing how you are using #Survey123 to make a difference in your organization.

 

User Presentations

 

Every year many dozens of users present at the Esri UC. Definitively a great opportunity to share work with your peers. We all learn when information is shared! You can check the Recent Proceedings from Esri events to see what people have shared in the past.

 

Gidelines to submit your abstract for the 2020 UC can be found at Call for Presentations | Esri User Conference 

 

In short:

 

  • Author/Presenter name(s)
  • Author/Presenter name(s)
  • Presentation title (10 words or fewer)
  • Company name
  • Complete address, phone, and email information
  • Brief presenter biography (25 words or fewer)
  • Abstract (500 characters or fewer, including spaces): Do not include information in your abstract that will not be in your presentation.
  • Keyword set (list only 3–5 keywords): Keywords are used to organize presentations into appropriate sessions, so choose words that clearly describe the main ideas of your work.

 

 

Become a Sponsor

 

Be aware that user papers and presentations must be noncommercial. If you plan on advertising a product, service or company, there other venues for you. You can Become a Sponsor or Exhibitor | 2020 Esri Partner Conference As a sponsor, you can have your own booth in the Showcase area, collaborate to put together Special Interest Groups, etc.

 


 

 

 

This is my contribution to notify to an user (if not using survey123 in disconnected mode) than the form needs to be reload.

 

 

 

How it‘s working:

 

 You publish a table in AGOL with a field contained the version info (VAL_VERSION), each time you open the form in the field survey123 a function *js send and ID, retrieve the version and the calculation perform the comparison

 

 

 

This example uses a javasript function to send and ID and retrieve the version

 

  

 

What you need:

 

 

 

      
  1.  The javascript code in the zip (contain, the *.xls and the *.js function)
  2.   
  3. Create a reference table or a feature service hosted  in AGOL( don't forget to share the table to the same group using yours Survey123)
  4.   
  5. The url of the reference table to retrieve the official value. The table is publish in AGOL. I provide a example of the table, see the cvs to create the table on AGOL.
  6.   
  7. Add an  folder named "extensions" in the survey123 project  containing the *.js.

 

 

 

Note :To make the JS functioning, each time you modify this the *.js file you need to close and reopen the survey123 connect app

 

 

 

Detail:

 

 

 

All the configuration are done from the xls

 

 This is the detail of the values in the XLS ant in the JS function :

 

 Javascript  function:

 

 function QueryFeatureLayerByField(featureLayer,Queryfield,Value,outFields,token,debugmode)

 

 Pulldata *.xls:

 

 pulldata("@javascript","myFunctionsFR_Demo.js","QueryFeatureLayerByField",${myURLversion},"ID",string(${ID_version}),"*",pulldata("@property","token"),true)

 

  

 

                                                                                                                                                       
variable in the function *.jsvaluespulldata correspondancedetails
featureLayer"https..../0"${myURLversion}table's URL
QueryfieldID"ID"the ID field for the query
Value1string(${ID_version})the value to retrieve in the query , ID = 1
outFields*"*"fied retrieve from the  query. ou can choose all the field * or a specific field “VAL_VERSION”

 

 

 

Survey123 connect:

 

 Result:

 

 

 

 

Exemple of the table:

 

 

 

 

 

This method could be also use to retrieve other info (from the survey himself, past summit ) to populate default value info.

 

 

 

thanks for the *.js code and the idea  to @Chelsea Rozek  for the post  Force update to new survey

 

and the post https://community.esri.com/message/823053-pulldata-json-to-query-feature-service-with-token