How to get item labeltext from .forEach cycle?

How to get item labeltext from range operator?
If i use code below, i got error:

java.lang.RuntimeException: The name '<XFeatureCallImplCustom>.label' cannot be resolved to an item or type.

	gAlarm?.members.filter[item|item.state == ON].forEach[item |
			logInfo("test", item.label)


itemtype itemname ["labeltext"] [<iconname>] [(group1, group2, ...)] [{bindingconfig}]

help needed. ?

No, i need ["labeltext"], is it possible?
Designer says for item. - String org.eclipse.smarthome.core.items.Item.getLabel()
But this generates error, why?

I see no error in that screenshot.

I just did a quick Designer test (did not run) and calling item.label does not generate an error for me in Designer.

Please look at my first post, I posted error there.

Hmmm. I actually ran my test and it worked. I’m not sure what could be wrong. What build are you running?

I use OH 1.8.3 and preparing my rules to OH2.

Ah, that’s the problem. You can’t get the label in 1.8, only 2.0.

Running openhab2, trying to get item name in rule. I know its there:

2017-04-30 19:39:08.911 [INFO ] [lipse.smarthome.model.script.Testing] - Test: Second_Floor_Condensate_Alarm (Type=ContactItem, State=OPEN, Label=Second Floor Condensate Alarm, Category=null, Groups=[Alarms])

However, if I try alarm.label I get nothing.

import java.util.concurrent.locks.ReentrantLock

var ReentrantLock lock = new ReentrantLock()

rule "Alarm Triggered"
  Item Alarms received update
  var boolean gotLock = lock.tryLock()
  logInfo("Testing", "Lock: " + gotLock)
  try {
    if(gotLock) {
      logInfo("Testing", "Alarms received update")
      val alarm = Alarms.members.filter[s|s.lastUpdate("mapdb") != null].sortBy[lastUpdate("mapdb")].last
      if (alarm.state == OPEN) {
        logInfo("Testing", "Test: " + alarm.lebel)
  finally {
    if(gotLock) {

Typo ?

oh man…