Split and Get value with arcade

6539
38
Jump to solution
06-11-2021 08:06 AM
KARIMLABIDI
Occasional Contributor

Hello,

On Arcgis Portal, I would like to represent my buses line with Arcade and HTML. I would like get the number of the line and put colors in relation to the numbers.

My value are like that on my stop feature : Line 1, Line 2, ..., Test 56.

My first problem is to get the number only. I can split the field but then I don't know how the get the value.

Is someone think it's possible or too complicated? With IIf maybe?

I know this blog but my problem is little more different. https://www.esri.com/arcgis-blog/products/arcgis-online/mapping/combining-arcade-and-html-for-a-real...


Thank you

0 Kudos
38 Replies
JohannesLindner
MVP Frequent Contributor

Hi again!

Yeah, please post the code you use. The HTML and at least one of the Arcade expressions.


Have a great day!
Johannes
0 Kudos
John_Shell
New Contributor III

Hi Johannes,

Can you help me with an issue in my pop-up?

Thanks,

John

https://tacoma.maps.arcgis.com/apps/mapviewer/index.html?webmap=c80eda9c8e434844a8ddbe742fc11a9c

This is for my expression1 links. The text display is correct for the intersecting polygons; however I don't know to to show individual weblinks without it merging the links together in a webpage.

0 Kudos
John_Shell
New Contributor III

Hi Pedro, Did you ever find a solution for your weblinks merging together like car.bike?

I am having similar issues.

Thank you

John

0 Kudos
JohannesLindner
MVP Frequent Contributor

Hey @John_Shell (and @PedroSoares1 , if you care),

this thread is messy enough, I'll post in the original question: Arcade Popups with multiple web links - Esri Community


Have a great day!
Johannes
PSGeo
by
Occasional Contributor
Thanks, for the support. I just took days off, I cannot be a big support on this.
I agree with u, too messy.
Kind regards,
Pedro


John_Shell
New Contributor III

Hi,

I am having issues with multiple links from a single field. A one to many and I need each hyperlink to be on its' own line. In the test of arcade it looks fine but in the popup after clicking on the link it merges two or more links together.

Thank you,

John Shell

0 Kudos
PedroSoares1
New Contributor II

Hi, I am bit busy this week. but could you share the code you have done? meanwhile this is a sample of what i have. cheers

1 - the custom attribute Display such as:

<tr style="display:{expression/expr0}"> <td style="width:200px; text-align:left; background-color:#302f2f; padding:2px"><a href="https://....">Car</a> </td> </tr>

2 - the two expressions: bike and car (remember need to be two expressions) such as:

//show_Car

var arrName = Split(replace($feature. Vehicle, " ", ""),",")

for (var i in arrName) {

      if(arrName[i]=="car") {return "block"}

      }

return "none"

John_Shell
New Contributor III
Hi Pedro,
Here is my expression for the links:

// Write a script to return a value to show in the pop-up.
// For example, get the average of 4 fields:
// Average($feature.SalesQ1, $feature.SalesQ2, $feature.SalesQ3, $feature.SalesQ4)

var areas =FeatureSetByName($map,"Neighborhood Council Districts (Tacoma)");
var Onefifty = Buffer($Feature, -150, 'feet')
var countp = Intersects(areas,Onefifty);

var result = "";
for (var item in countp){
var id = item["URL"] + Textformatting.newline + Textformatting.newline;
result += id + '\n'

}
return (result)


Thank you,
John
0 Kudos
PSGeo
by
Occasional Contributor
How do u have your attribute display code?
0 Kudos
John_Shell
New Contributor III
In the arcade expression and then in the pop up editor in Map Viewer.
Thanks,
John
0 Kudos