Defining Labels in Show Results to show in Results list at VertiGIS Studio Web
I have two problems:
First: within the Label Format I want to set a ternary operator like “condition ? exprIfTrue : exprIfFalse” I use the Output Fields from a layer query as variable.
Problem is that it only shows false or true on all results
I tried like this:
=({B} == Null) ? '{A},' : '{A}/{B}'
In Case field B is empty or null = true display field A if false display field A / field B
The part ({B} == Null) I also tried with {B}>=1 or {B} == undefined or {B} == ‘Null’
Problem is that it only shows false or true at all results
I also tried to combin it with includes() like {B}.includes() and {B}.isEmpty() . Then getting erro message in console “TypeError: (intermediate value).isEmpty is not a function”
Second: within Description Format I have a link to connect data from a different database
The link itself looks like https://mylink.com/data?values={C}
It works fine with standard html like <a href="https://mylink.com/data?values={C}">TextToLink</a> but I need it to open as a pop up window
when trying to use <a href> with javascript command window.open() to open a pop up window it ist not working.
Here I tried like <a href="https://mylink.com/data?values={C}" target="popup" onclick="window.open('https://mylink.com/data?values={C}','popup','width=600,height=600')>TextToLink</a>
I also tried some other possible scripting e.g. onclick="javascript:window.open but that did not work.
Maybe the solution is quite simple but at the moment I just got stuck here
-
HI Michael Nowak where you ever able to work out the first part? with the conditional statements?
0 -
Hi Andreas,
you can not use this in the label format field at the show results activity. That info I got from Support consultant.
With that VertiGIS support consultant we created an evaluate expression activity which defines the label for each feature. This output of this is defined as expression in the show results labels.
the evaluate expression looks like this:
=((features) => {
for (i = 0; i < features.length; i++) {
const label = (features[i].attributes.B === undefined || features[i].attributes.B === null) ?
`Text: ${features[i].attributes.A}` :
`Text: ${features[i].attributes.A}/${features[i].attributes.B}`;
features[i].attributes.TEXTLABEL = label;
}
})($query.features)at show results activity the label format looks like this:
='{TEXTLABEL}'
0
Vous devez vous connecter pour laisser un commentaire.
Commentaires
2 commentaires