How can I access generic items in a function?

Hello,
I like to write a lambda functions where I have access to generic items inside. The Problem is that I need more then 6 parameters for the function. That’s why I like to setup some local vars in the function derived by the name of a function parameter.
Maybe something like that:
var GenericItem test
test.setItemByName(“Name of a real item”)
BR
Ron

It sounds like you are heading down the wrong path in your approach to writing Rules DSL code. See Design Pattern: DRY, How Not to Repeat Yourself in Rules DSL for better approaches.

In general, IMHO, the use of global lambdas is a code smell. Needing lambdas with more than 6 arguments is a code stench.

That being said, You can still access Items by name inside a lambda. So you can just use RealItemName.sendCommand(blah) and the like. But anything else will require it be passed as an argument to the lambda.

This technique may be useful too

Thank you for the hints … Anyway I found what I was searching for in this thread rules-dsl-get-item-from-string-name This makes the interface much more smaller if you follow some DP for naming. Unfortunately I don’t see any better approach then a function/lambda if don’t want to type the code more the one time.

You haven’t shared your code so it’s had to say. But with what little you’ve shared it seems like using Groups and Member of triggers combined with the Associated Item DP should let you write one Rule to handle all the Items that do the same thing.