[SOLVED] finding a pre-existing item with a name from string variable

Hello,

I have the following problem:
I get an itemname from a map transformation and than I want to check the value (open/closed) inside an if clause. This i my line to find the name in the map file.

val windows = transform("MAP", "raeume_2.map", raum) as ContactItem

But I get the following error from VSCode:

Cannot cast from String to ContactItem(org.eclipse.xtext.xbase.validation.IssueCodes.invalid_cast)

I have no idea what to do. I think the val windows is a string and needs to be converted to an “Item”.

Thank you for your help!

That’s correct. The task is not converting a string to an Item, but instead finding a pre-existing Item with a name matching your string, right?

There’s more than one way to do that.

1 Like