Hey, can anyone help me please to understand how i can return a output of a assembled string?
For each group member whose status is not “Keine”, it should expand the string and output it after the last group member.
1. Cannot refer to the non-final variable BuildPollenString inside a lambda expression; line 4, column 120, length 17
2. Cannot refer to the non-final variable BuildPollenString inside a lambda expression; line 8, column 379, length 17
var String BuildPollenString
Grp_DWD_PollenIndex.members.filter[ i | i.state != 0 ].forEach[ i |
var String PollenIndex
BuildPollenString = "Meldung: \n"
PollenIndex = transform("MAP", "DWDPollen.map", i.state.toString)
if (PollenIndex != "Keine") {
//logInfo("Pollen", ""+ i.label +" = " + PollenIndex)
BuildPollenString += ""+ i.label +" = " + PollenIndex +"\n"
}
]
logInfo("Pollen",""+BuildPollenString)
Well, the non-final var is because it’s a local var.
You have to use a global var for this purpose.
As I’m also using the dwdpollenflug addon: Are you aware of the fact, that each Index Item has to be of type String, therefor the filter has to be [ i | i.state.toString != "0" ]