# \[question\] system.perspective.sendMessage return value?

**URL:** <https://forum.inductiveautomation.com/t/question-system-perspective-sendmessage-return-value/23566>\
**Category:** Ignition Early Access\
**Created:** [March 25, 2019, 2:29pm UTC](https://forum.inductiveautomation.com/t/question-system-perspective-sendmessage-return-value/23566 "2019-03-25T14:29:23Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![BumbleBeeTuna](https://avatars.discourse-cdn.com/v4/letter/b/cc9497/32.png) [@BumbleBeeTuna](https://forum.inductiveautomation.com/u/BumbleBeeTuna)\
**Post date:** [March 25, 2019, 2:29pm UTC](https://forum.inductiveautomation.com/t/question-system-perspective-sendmessage-return-value/23566/1 "2019-03-25T14:29:23Z")

</div>

Any plans for system.perspective.sendMessage to return a value?

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [March 25, 2019, 2:46pm UTC](https://forum.inductiveautomation.com/t/question-system-perspective-sendmessage-return-value/23566/2 "2019-03-25T14:46:05Z")

</div>

What sort of value would it return?

The philosophy of Perspective’s sendMessge() use is more or less like a radio broadcast; if you’re tuned in (listening on the right channel and at the right scope), you can hear the broadcast message.

But a radio station doesn’t know that you have your radio tuned to their station.

If you want something along the lines of a send/response communication, you’ll need to configure an additional sendMessage going the OTHER way, which would turn the components into something approaching walkie-talkies.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [March 25, 2019, 2:59pm UTC](https://forum.inductiveautomation.com/t/question-system-perspective-sendmessage-return-value/23566/3 "2019-03-25T14:59:41Z")

</div>

He’s asking for an equivalent to `system.util.sendRequest`.

---

<div class="post-metadata">

**Author:** ![BumbleBeeTuna](https://avatars.discourse-cdn.com/v4/letter/b/cc9497/32.png) [@BumbleBeeTuna](https://forum.inductiveautomation.com/u/BumbleBeeTuna)\
**Post date:** [March 25, 2019, 3:30pm UTC](https://forum.inductiveautomation.com/t/question-system-perspective-sendmessage-return-value/23566/4 "2019-03-25T15:30:48Z")

</div>

@Kevin.Herron is correct. I’d like to return whatever if needed. If there’s no intent of sendMessage returning then your suggestion will work.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [March 25, 2019, 3:33pm UTC](https://forum.inductiveautomation.com/t/question-system-perspective-sendmessage-return-value/23566/5 "2019-03-25T15:33:38Z")

</div>

One main difference is that system.util.sendMessage() will only ever reach one handler on the other side - there’s no way to have multiple message handlers handle the same message.

Perspective’s message handling is inherently different - not only _can_ you have multiple identical message handlers, you probably should if you’re using message handlers to their full potential.

---

<div class="post-metadata">

**Author:** ![mbrown](https://avatars.discourse-cdn.com/v4/letter/m/e68b1a/32.png) [@mbrown](https://forum.inductiveautomation.com/u/mbrown)\
**Post date:** [September 6, 2019, 3:37pm UTC](https://forum.inductiveautomation.com/t/question-system-perspective-sendmessage-return-value/23566/6 "2019-09-06T15:37:58Z")

</div>

I know this is an old thread, but I have a follow-up question. I like using sendMessage to set values, but how can I get the content of several fields without explicit paths? I need to get the content of several text fields which will then be used as parameters for an SQL query. I haven’t found a way for my query script to request the data from the fields without explicitly using the path to the appropriate props.text property.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [September 6, 2019, 5:08pm UTC](https://forum.inductiveautomation.com/t/question-system-perspective-sendmessage-return-value/23566/7 "2019-09-06T17:08:30Z")

</div>

With… `sendMessage` of course!

For whatever fields you need to supply to your query, set up a `propertyChange` script for each of the components which uses `sendMessage` to broadcast their new value.

Configure the component which will execute the query to have custom properties - one for each required query parameter. This component should also be listening for all of the message types and on appropriate scopes. When it “hears” a messageType, it should set the corresponding custom property with the new value. Then, configure the query to read from this component’s custom properties, instead of linking it to other components.

Text Field component property change script:

```auto
system.perspective.sendMessage('UPDATEBAY',payload={'bay':self.props.text},scope='page')

```

Query Button Message Handler:

```auto
self.custom.bay = payload['bay']

```

Query Button onActionPerformed Script:

```auto
system.db.runSomeQueryMethod('select pallets from warehouse where bayName={0}'.format(self.custom.bay), other_args)

```

---

<div class="post-metadata">

**Author:** ![mbrown](https://avatars.discourse-cdn.com/v4/letter/m/e68b1a/32.png) [@mbrown](https://forum.inductiveautomation.com/u/mbrown)\
**Post date:** [September 6, 2019, 6:14pm UTC](https://forum.inductiveautomation.com/t/question-system-perspective-sendmessage-return-value/23566/8 "2019-09-06T18:14:50Z")

</div>

Thanks. I’ll try that. I set properties at the view level for now, using sendMessage, so they wouldn’t be affected by any component changes.
