I have 4 Attributes in One label.
I have 4 attributes in 1 label.
Each attribute starts with a title and then the text.
If the text = null for an attribute I would not want to see a title for this attribute.
Do I have to write a completely new script for each attribute?
"ZEE-"&"<BOL><CLR red='21' green='47' blue='255'>" & [Km_paal_in_zee] & "</CLR></BOL>"& vbNewLine &
" OP-"&"<BOL><CLR red='21' green='47' blue='255'>"& [Oriëntatiepaal]& "</CLR></BOL>"& vbNewLine &
"Vast-"&"<BOL><CLR red='21' green='47' blue='255'>" &[vaste_plaatsnaam]& "</CLR></BOL>"& vbNewLine &
"Lok-"&"<BOL><CLR red='21' green='47' blue='255'>" &[Lokale_benaming]& "</CLR></BOL>"
Solved! Go to Solution.
Switch tha language to Arcade, use this expression:
var titles = ["ZEE", "OP", "Vast", "Lok"]
var values = [
$feature.Km_paal_in_zee,
$feature.Oriëntatiepaal,
$feature.vaste_plaatsnaam,
$feature.Lokale_benaming,
]
var lines = []
for(var i in titles) {
if(!IsEmpty(values[i])) {
var line = `${titles[i]}-<BOL><CLR red="21" green="47" blue="255">${values[i]}</CLR></BOL>`
Push(lines, line)
}
}
return Concatenate(lines, TextFormatting.NewLine)
Switch tha language to Arcade, use this expression:
var titles = ["ZEE", "OP", "Vast", "Lok"]
var values = [
$feature.Km_paal_in_zee,
$feature.Oriëntatiepaal,
$feature.vaste_plaatsnaam,
$feature.Lokale_benaming,
]
var lines = []
for(var i in titles) {
if(!IsEmpty(values[i])) {
var line = `${titles[i]}-<BOL><CLR red="21" green="47" blue="255">${values[i]}</CLR></BOL>`
Push(lines, line)
}
}
return Concatenate(lines, TextFormatting.NewLine)
🙂
You made my day!
Thanks