Select to view content in your preferred language

Arcade Generated URL field not being detected by survey 123.

375
1
07-18-2023 07:40 AM
ThomasDarley1
New Contributor II

I'm having issues loading in a field embedded in a URL into survey 123 on a android device. It works fine when running the app on my windows pc, loading the survey from AGOL webmap popup directly. Not when using Field Maps  popup link on my android device. 

The URL i'm generating looks like this :

https://survey123.arcgis.app/?itemID=594ea06d6bdb4a8da6187c2d783ae932&field:SWCM_PCO_ID%20=SWCM_PCO_...:Element_Values=4261%3DCrest%2CMasonary%2C7%2C0%2C0%26amp%3B4262%3DExposed%2520Face%2CMasonary%2C7%2C0%2C0%26amp%3B4263%3DLandward%2520Face%2CMasonary%2C7%2C0%2C0&field:Line_Coordinates%20=50.35782096250964%20-4.171853226807554%3B50.35741457217176%20-4.172252528749949%3B50.35706276877129%20-4.17262330912503%3B;

The arcade expression used to generate the Element Values: 

var swcm_id = $feature.swcm_pco_id;
console(swcm_id);

var tbl = FeatureSetByName($datastore,"Elements");
console (tbl);

var sql = "asset_id= '" + swcm_id + "'";

var related_data = Filter(tbl, sql);
// Assign the related_data to a new attribute
console (related_data);

var element_dictionary = {};

for (var row in related_data) {

var key = row['element_id'];
var value = [row['element_type'],
row['element_material'],
row["element_weighting"],
row["element_condition"],
row["element_ni"]
];

console (key)
console (value)

// Update or add key-value pair in the dictionary
element_dictionary[Text(key)] = value;};

var encodedParams = [];
for (var key1 in element_dictionary) {
var encodedKey = UrlEncode(key1);
console(encodedKey)
var values = element_dictionary[key1];
var encodedValues = [];

for (var i in values) {
var encodedValue = UrlEncode(values[i]);
Push(encodedValues,encodedValue);
}

The expression uses the selected line feature, extracts a unique ID and then searches a Element table also in the webmap for the values to format ready to be inserted into the URL. 

I can't crack this, and the app is meant to be going out to contractors in a couple of weeks any ideas? 

The log from the app, shows the Element Values are not showing, loading in: 

ArcGISSurvey123 18388 - - $ Logging started: 2023-07-18T14:49:18
<14>1 2023-07-18T13:49:18Z localhost ArcGISSurvey123 18388 - - $ Application Name: ArcGISSurvey123
<14>1 2023-07-18T13:49:18Z localhost ArcGISSurvey123 18388 - - $ Application Version: 3.18.142
<14>1 2023-07-18T13:49:18Z localhost ArcGISSurvey123 18388 - - $ Application File Path: /data/app/com.esri.survey123-M3MIg1xwK0-Sb_OIGuJvbw==/lib/arm64/libSurvey123_arm64-v8a.so
<14>1 2023-07-18T13:49:18Z localhost ArcGISSurvey123 18388 - - $ Application Directory Path: /data/app/com.esri.survey123-M3MIg1xwK0-Sb_OIGuJvbw==/lib/arm64
<14>1 2023-07-18T13:49:18Z localhost ArcGISSurvey123 18388 - - $ AppFramework Version: 5.5.180
<14>1 2023-07-18T13:49:18Z localhost ArcGISSurvey123 18388 - - $ Qt Version: 5.15.6
<14>1 2023-07-18T13:49:18Z localhost ArcGISSurvey123 18388 - - $ Operating System: Android  (10.0)
<14>1 2023-07-18T13:49:18Z localhost ArcGISSurvey123 18388 - - $ Operating System Type: android
<14>1 2023-07-18T13:49:18Z localhost ArcGISSurvey123 18388 - - $ Operating System Version: 10.0
<14>1 2023-07-18T13:49:18Z localhost ArcGISSurvey123 18388 - - $ Kernel Type: linux
<14>1 2023-07-18T13:49:18Z localhost ArcGISSurvey123 18388 - - $ Kernel Version: 4.14.117-perf-g0f2347b
<14>1 2023-07-18T13:49:18Z localhost ArcGISSurvey123 18388 - - $ Build ABI: arm64-little_endian-lp64
<14>1 2023-07-18T13:49:18Z localhost ArcGISSurvey123 18388 - - $ Current CPU Architecture: arm64
<14>1 2023-07-18T13:49:18Z localhost ArcGISSurvey123 18388 - - $ Build CPU Architecture: arm64
<14>1 2023-07-18T13:49:18Z localhost ArcGISSurvey123 18388 - - $ SSL Library Version: OpenSSL 1.1.1t  7 Feb 2023
<14>1 2023-07-18T13:49:18Z localhost ArcGISSurvey123 18388 - - $ Host name: localhost
<14>1 2023-07-18T13:49:18Z localhost ArcGISSurvey123 18388 - - $ Domain name: 
<14>1 2023-07-18T13:49:18Z localhost ArcGISSurvey123 18388 - - $ Default locale: en_GB
<14>1 2023-07-18T13:49:18Z localhost ArcGISSurvey123 18388 - - $ Release Type: 
<15>1 2023-07-18T13:49:30Z localhost ArcGISSurvey123 18388 - [AppStudio@11205 category="qml" function="closePage" filename="AppPage.qml" line="314"] qml: backPage undefined
<15>1 2023-07-18T13:49:30Z localhost ArcGISSurvey123 18388 - [AppStudio@11205 category="AppSettings" function="write" filename="AppSettings.qml" line="448"] AppSettings: Writing app settings - /storage/emulated/0/Android/data/com.esri.survey123/files/ArcGIS/AppStudio/Settings/1b899f24e9354a459a2ab2ed4cc8e8d7.json
<15>1 2023-07-18T13:49:32Z localhost ArcGISSurvey123 18388 - [AppStudio@11205 category="qml" function="closePage" filename="AppPage.qml" line="314"] qml: backPage undefined
<12>1 2023-07-18T13:49:32Z localhost ArcGISSurvey123 18388 - [AppStudio@11205 category="default" filename=""] <Unknown File>: QML QQuickAnchors: Binding loop detected for property "margins"
<12>1 2023-07-18T13:49:32Z localhost ArcGISSurvey123 18388 - [AppStudio@11205 category="default" filename=""] <Unknown File>: QML QQuickAnchors: Binding loop detected for property "margins"
<15>1 2023-07-18T13:49:32Z localhost ArcGISSurvey123 18388 - [AppStudio@11205 category="HomeViewTabs" function="updateVisibleCount" filename="HomeViewTabs.qml" line="86"] HomeViewTabs: visibleCount: 1
<15>1 2023-07-18T13:49:34Z localhost ArcGISSurvey123 18388 - [AppStudio@11205 category="Portal" function="onStateChanged" filename="Portal.qml" line="446"] Portal: Application state changed: 2
<12>1 2023-07-18T13:49:34Z localhost ArcGISSurvey123 18388 - [AppStudio@11205 category="default"] QEGLPlatformContext: eglSwapBuffers failed: 300d
<12>1 2023-07-18T13:49:34Z localhost ArcGISSurvey123 18388 - [AppStudio@11205 category="default"] QEGLPlatformContext: eglSwapBuffers failed: 300d
<12>1 2023-07-18T13:49:34Z localhost ArcGISSurvey123 18388 - [AppStudio@11205 category="default"] QEGLPlatformContext: eglSwapBuffers failed: 300d
<12>1 2023-07-18T13:49:34Z localhost ArcGISSurvey123 18388 - [AppStudio@11205 category="default"] QEGLPlatformContext: eglSwapBuffers failed: 300d
<15>1 2023-07-18T13:49:34Z localhost ArcGISSurvey123 18388 - [AppStudio@11205 category="Portal" function="onStateChanged" filename="Portal.qml" line="446"] Portal: Application state changed: 0
<15>1 2023-07-18T13:49:36Z localhost ArcGISSurvey123 18388 - [AppStudio@11205 category="default"] void Java_com_arcgis_appframework_QmlApplicationActivity_openUrl(JNIEnv *, jobject, jstring) QUrl("https://survey123.arcgis.app/?itemID=594ea06d6bdb4a8da6187c2d783ae932&field:SWCM_PCO_ID =SWCM_PCO_1937&field:Asset_Name=Mount Edgecumbe Engineered High Ground 1&field:Description=Mount Edgecumbe Engineered High Ground 1&field:Asset_Location=Mount Edgecumbe Engineered High Ground 1&field:Asset_Type=Defence&field:Asset_Sub_Type=Engineered High Ground&field:Date_Of_Last_Assessment=2018-06-15 12:27:39&field:Frequency=24.00&field:Inspected_Condition=3.00&field:Inspection_Alert_Detail=&field:Fixed_Photo_Detail=&field:Target_Condition=3.00&field:Access_Code=LW&field:Element_Values=&field:Line_Coordinates =50.360106890050936 -4.17462082056237;50.35988788109945 -4.174574751361323;50.359804923073057 -4.174552458769253;50.3597456669237 -4.174532395795678;50.35970347688076 -4.174516049152462;50.359669345086836 -4.174498957805852;50.3596281028757 -4.174485582789602;50.35959776377474 -4.1744670074261547;50.359547989245186 -4.1744231660470437;50.359465977954528 -4.1743458875764;50.3594095662402 -4.174296102943364;50.35932091879757 -4.1742255124300156;50.359299585755856 -4.1742047056514116;50.359266877251045 -4.1741519493914057;50.3592208940056 -4.1740159678135758;50.35916969607153 -4.173825001255541;50.35913508993905 -4.1736897643810718;50.359110439129175 -4.173600596707648;50.359081048181 -4.1734980540179745;50.3590578192095 -4.1733873375575428;50.3590445461614 -4.1732944553504217;;") : QmlApplication(0x72b96e0ea0)
<15>1 2023-07-18T13:49:36Z localhost ArcGISSurvey123 18388 - [AppStudio@11205 category="default"] void QmlApplication::openUrl(const QUrl &) QUrl("https://survey123.arcgis.app/?itemID=594ea06d6bdb4a8da6187c2d783ae932&field:SWCM_PCO_ID =SWCM_PCO_1937&field:Asset_Name=Mount Edgecumbe Engineered High Ground 1&field:Description=Mount Edgecumbe Engineered High Ground 1&field:Asset_Location=Mount Edgecumbe Engineered High Ground 1&field:Asset_Type=Defence&field:Asset_Sub_Type=Engineered High Ground&field:Date_Of_Last_Assessment=2018-06-15 12:27:39&field:Frequency=24.00&field:Inspected_Condition=3.00&field:Inspection_Alert_Detail=&field:Fixed_Photo_Detail=&field:Target_Condition=3.00&field:Access_Code=LW&field:Element_Values=&field:Line_Coordinates =50.360106890050936 -4.17462082056237;50.35988788109945 -4.174574751361323;50.359804923073057 -4.174552458769253;50.3597456669237 -4.174532395795678;50.35970347688076 -4.174516049152462;50.359669345086836 -4.174498957805852;50.3596281028757 -4.174485582789602;50.35959776377474 -4.1744670074261547;50.359547989245186 -4.1744231660470437;50.359465977954528 -4.1743458875764;50.3594095662402 -4.174296102943364;50.35932091879757 -4.1742255124300156;50.359299585755856 -4.1742047056514116;50.359266877251045 -4.1741519493914057;50.3592208940056 -4.1740159678135758;50.35916969607153 -4.173825001255541;50.35913508993905 -4.1736897643810718;50.359110439129175 -4.173600596707648;50.359081048181 -4.1734980540179745;50.3590578192095 -4.1733873375575428;50.3590445461614 -4.1732944553504217;;")

All the best

Tom. 

 

 

1 Reply
DougBrowning
MVP Esteemed Contributor
0 Kudos