# Struggling with data expression

**URL:** <https://discourse.nodered.org/t/struggling-with-data-expression/62007>\
**Category:** General\
**Tags:** home-assistant\
**Created:** [30 April 2022 19:25 UTC](https://discourse.nodered.org/t/struggling-with-data-expression/62007 "2022-04-30T19:25:59Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![TheLoudSteve](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/theloudsteve/32/60847_2.png) [@TheLoudSteve](https://discourse.nodered.org/u/TheLoudSteve)\
**Post date:** [30 April 2022 19:25 UTC](https://discourse.nodered.org/t/struggling-with-data-expression/62007/1 "2022-04-30T19:25:59Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/d/4dc8ddf226f1c35d1eb660293816dcd28f482d60.jpeg)

I am using the injection node, with a msg.device set to "Fridge"

If I pass it straight to the debug node, it works as expected.

I'm trying to pass it to a Home Assistant call service node, and have it push the string "Fridge left open".

I can't quite get the handle of how to leverage strings passed along in the flow, and google is failing me, likely due to the fact that I'm not quite sure what to search for 🙂 Would really appreciate an assist.

P.S. What I described is a test, long term I will be passing several Call States into the same notification node and want the notification to list the device that has been open for more than x minutes.

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [30 April 2022 20:31 UTC](https://discourse.nodered.org/t/struggling-with-data-expression/62007/2 "2022-04-30T20:31:33Z")

</div>

Try

```auto
{
"message": $$.device & " left open"
}

```

---

<div class="post-metadata">

**Author:** ![TheLoudSteve](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/theloudsteve/32/60847_2.png) [@TheLoudSteve](https://discourse.nodered.org/u/TheLoudSteve)\
**Post date:** [1 May 2022 00:37 UTC](https://discourse.nodered.org/t/struggling-with-data-expression/62007/3 "2022-05-01T00:37:45Z")

</div>

Brilliant! That did the trick. Thank you.

---

<div class="post-metadata">

**Author:** ![greengolfer](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/greengolfer/32/28276_2.png) [@greengolfer](https://discourse.nodered.org/u/greengolfer)\
**Post date:** [1 May 2022 07:05 UTC](https://discourse.nodered.org/t/struggling-with-data-expression/62007/4 "2022-05-01T07:05:52Z")

</div>

On the longer run, you may want to use [https://try.jsonata.org/](https://try.jsonata.org/) . When struggling (I guess like 99% of us 🙂 ) with jsonata syntax, I am using this site for trial and error.  
On the left you put the json you want. On the right, the jsonata and the result.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [30 June 2022 07:06 UTC](https://discourse.nodered.org/t/struggling-with-data-expression/62007/5 "2022-06-30T07:06:26Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
