I have arcade expression, {expression/expr0}, contains multi values, for example: [A1, A2, B1, B2]. I am wondering if there is a way to extract each of those values in the HTML. for example if I would like get A1 and B1 in first HTML line and get A2 and B2 in second HTML line without needed to create each individual Arcade expression.
Thank you.
You can use an Arcade element that contains your values with HTML coding. Take a look at this blog for a deeper dive into them.
Thank you! I was almost there.
Now in my arcade expression I can return values:
return {
type: "fields",
fieldInfoa1: A1,
fieldInfoa2: A2,
fieldInfb1: B1,
fieldInfb2: B2}
However, in the HTML Popup, I can see arcade expression as [object object] or as dictionary type but I struggled on how to parse individual value. I tried {expression/expr0[0]}, {expression/expr0.0}, {expression/expr0/fieldInfoa1} but didn't work. Any idea on?
Thank you.
Your return contains just two properties, type and text. The text property will contain the values and HTML code. The blog shows an example of how you can put that directly into the text property. You can also use a variable. For example, here's one I did recently
var related = FeatureSetByRelationshipName($feature, "DCGIS.SURDOCS");
var relatedCount = count(related);
var output;
if (relatedCount == 0) {
output = `<p>There are no surveys for this property.<\p>`;
} else if (relatedCount == 1) {
var rec = First(related);
output = `There is 1 survey for this property:
<br>  • <a href="${rec.FILENETLINK}">${rec.DOCGUID}</a>`;
} else {
output = `There are ${relatedCount} surveys for this property:`;
for (var rec in related) {
output += `<br>  • <a href="${rec.FILENETLINK}">${rec.DOCGUID}</a>`;
}
}
return {
type : 'text',
text : output
}
which produced this popup, containing clickable links
Thank you for the example. But I need individual field value which those values will be in table format in HTML, my return format is like this:
return {
type: "fields",
fieldInfoa1: A1,
fieldInfoa2: A2,
fieldInfob1: B1,
fieldInfob2: B2}
Take a look at this post, which shows how to return fieldnames. You would just have one fieldInfo with several values in it
Thank you! I saw that post and asked question in the post. I don't see it is possible to extract each variable/attribute in the HTML code. Also, I opened an Esri support case and they said it is NOT possible.