# "Pass by reference" calling object to rule?

**URL:** <https://community.openhab.org/t/pass-by-reference-calling-object-to-rule/37412>\
**Category:** Scripts & Rules\
**Tags:** rules, object, passing\
**Created:** [December 18, 2017, 12:56am UTC](https://community.openhab.org/t/pass-by-reference-calling-object-to-rule/37412 "2017-12-18T00:56:34Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Josar](https://community.openhab.org/user_avatar/community.openhab.org/josar/32/13357_2.png) [@Josar](https://community.openhab.org/u/Josar)\
**Post date:** [December 18, 2017, 1:01am UTC](https://community.openhab.org/t/pass-by-reference-calling-object-to-rule/37412/2 "2017-12-18T01:01:53Z")

</div>

You might want to use groups

> [@Design Pattern: Working with Groups in Rules](https://community.openhab.org/t/design-pattern-working-with-groups-in-rules/20512):
>
> Edit: Updates for OH 4, inclusion of JS Scripting and Blockly examples, removed the doors example as it’s superfluous. Please see [Design Pattern: What is a Design Pattern and How Do I Use Them](https://community.openhab.org/t/design-pattern-what-is-a-design-pattern-and-how-do-i-use-them/40319) for how to read and use DPs. Problem Statement One powerful way to consolidate code in rules is to use array/list manipulation operations on the members of a Group. For example, filter down to just those members that are ON, get a list of the labels of those Items that are NULL, etc. Concept T…

Or lamdas

> [@Reusable Functions: A simple lambda example with copious notes](https://community.openhab.org/t/reusable-functions-a-simple-lambda-example-with-copious-notes/15888):
>
> Major Edit: Rewrote with the cleaner OH 2.3 syntax. The example lambda on the OH 1 wiki is overly complex and as written will not work in OH 2. This quick example will show a super simple lambda example with copious notes. Here is the code without comments. It takes in an Item, logs it’s state and returns a slightly modified version of the String logged. val log= [GenericItem s | logInfo("lambda", s.state.toString) s.state.toString + " logged"] rule "Call Lambda" when // some t…

---

_[View the full topic](https://community.openhab.org/t/pass-by-reference-calling-object-to-rule/37412)._
