Hello!
I have a bit of web-dev background but I'm new to Ignition and new to industrial automation. I'm currently trying to build out a list of station points in a Leaflet module inside a perspective view. To test this, I was able to go through and manually (one by one) associate the latitude, longitude, and the popup content text fields with their respective tags for the station (basically: [default]station/$x/$x_latlong, and [default]station/$x/$x_Name where $x is the name code for the station). In the screenshot below, you can see that I've used the unique station code as the name property for the current position in the ui.marker tree.
What I'm trying to do is find a consistent way to build out this map that doesn't rely on me having to duplicate a bunch of code or text (since this increases the risk of human error). By reading the documentation, I've figured out that I can reference that code in an expression to get the full tag:
tag("[default]LS/"+{this.props.layers.ui.marker[0].name}+"/"+{this.props.layers.ui.marker[0].name}+"_latlong")
...but this still requires me to define the specific name property instead of referencing it's own position. I'd like to simplify that further to something like this (where $x is the current position in the ui marker tree...
tag("[default]LS/"+{this.props.layers.ui.marker[$x].name}+"/"+{this.props.layers.ui.marker[$x].name}+"_latlong")
or (in my own imagined pseudo-code):
tag("[default]LS/"+{~.name}+"/"+{~.name}+"_latlong")
NOTE: I also have some expression and/or jython code that splits the above string and converts the output to a double/float value that leaflet understands, however I didn't want to complicate this post with those details since they are working properly.
Again, I'm trying to simplify this expression code so that it's self referencing the required unique station identifier and tag properties and placing them into the Leaflet widget. If I was doing this in HTML/JavaScript/PHP/etc, I'd define an array and a few variables, write out a for-loop to dump those values into the leaflet code as the page loads, then proceed on my way, but I don't see any kind of equivalent in Ignition which means I'm manually clicking and associating these values with their correct tags. This feels like the wrong way to do this, but I know I'm too new to this to know better. I've been Googl'ing all morning but haven't found much besides what I've already laid out.
Thanks for your time. Please let me know if I've come about this the wrong way and if there's a better way to use this system. I'm trying to learn and improve our operations at the same time.