Convert String to Item

Is this somehow possible to do in a rule?

val nameParts ="_")
val phoneLocation = nameParts.get(0) + "_Location"
val PointType phone_location = phoneLocation.state as PointType 

The problem is that this item is String, but I need this as an Item… (I have an item which is called Name_Location…)

The type of that Item is Location… I have tried with … as PointType, but I have failed…

I have find a way for my problem :slight_smile:

val locationName = nameParts.get(0) + "_Location"
val locationItem = gPhoneLocation.members.findFirst[ i | == locationName ]

It’s not a workaround. It’s the way to do it.

Thanks! :slight_smile: I have used this filter more times, but I didn’t know that this is the only way to get reference to an item!

It’s A way to do it. There is another way. See the third option in the rewritten Design Pattern: Associated Items.

Thanks to 5iver for discovering we can pull Items straight out of the Item Registry without going through the Group.