# Variable instead of fixed value

**URL:** <https://discourse.nodered.org/t/variable-instead-of-fixed-value/86563>\
**Category:** General\
**Created:** [19 March 2024 13:39 UTC](https://discourse.nodered.org/t/variable-instead-of-fixed-value/86563 "2024-03-19T13:39:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ziege3.0](https://avatars.discourse-cdn.com/v4/letter/z/85e7bf/32.png) [@ziege3.0](https://discourse.nodered.org/u/ziege3.0)\
**Post date:** [19 March 2024 13:39 UTC](https://discourse.nodered.org/t/variable-instead-of-fixed-value/86563/1 "2024-03-19T13:39:15Z")

</div>

Hello, is it possible to set a variable instead of the 15?  
It would be enough for me if I could define it once in the node.  
PS: sorry about my english.  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/3/e3e5bcb3633cb1b107aa5206aad0b388f49accdc.png)

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [19 March 2024 15:00 UTC](https://discourse.nodered.org/t/variable-instead-of-fixed-value/86563/2 "2024-03-19T15:00:23Z")

</div>

Hello @ziege3.0, welcome to the forum.

You can use a flow context variable like this

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/4/64b6a7cc962e18fa8647809c216a32e267c02d1f.png)

```auto
[{"id":"738166d64cb4d37d","type":"group","z":"601087fc1d806c98","name":"Set a flow context variable","style":{"label":true},"nodes":["03a7f2901b4f1477","4dcc831f0e9b2c1c","360968ba490f25ef","fae5d319b37cb91e"],"x":14,"y":39,"w":392,"h":162},{"id":"03a7f2901b4f1477","type":"inject","z":"601087fc1d806c98","g":"738166d64cb4d37d","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"10","payloadType":"num","x":110,"y":80,"wires":[["fae5d319b37cb91e"]]},{"id":"4dcc831f0e9b2c1c","type":"inject","z":"601087fc1d806c98","g":"738166d64cb4d37d","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"15","payloadType":"num","x":110,"y":120,"wires":[["fae5d319b37cb91e"]]},{"id":"360968ba490f25ef","type":"inject","z":"601087fc1d806c98","g":"738166d64cb4d37d","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"20","payloadType":"num","x":110,"y":160,"wires":[["fae5d319b37cb91e"]]},{"id":"fae5d319b37cb91e","type":"change","z":"601087fc1d806c98","g":"738166d64cb4d37d","name":"","rules":[{"t":"set","p":"trigger","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":300,"y":120,"wires":[[]]},{"id":"07c2bcb4c11d927b","type":"group","z":"601087fc1d806c98","name":"Test input value","style":{"label":true},"nodes":["3fd1cd7735607ab9","1d7916082075eea5","c3fd0d2098f59f68"],"x":14,"y":219,"w":532,"h":82},{"id":"3fd1cd7735607ab9","type":"debug","z":"601087fc1d806c98","g":"07c2bcb4c11d927b","name":"Output","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":450,"y":260,"wires":[]},{"id":"1d7916082075eea5","type":"switch","z":"601087fc1d806c98","g":"07c2bcb4c11d927b","name":"<= flow.trigger","property":"payload","propertyType":"msg","rules":[{"t":"lte","v":"trigger","vt":"flow"}],"checkall":"true","repair":false,"outputs":1,"x":280,"y":260,"wires":[["3fd1cd7735607ab9"]]},{"id":"c3fd0d2098f59f68","type":"inject","z":"601087fc1d806c98","g":"07c2bcb4c11d927b","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"19","payloadType":"num","x":110,"y":260,"wires":[["1d7916082075eea5"]]}]

```

ps Sorry about my English too, but it's all I've got 🙃

---

<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:** [17 June 2024 15:00 UTC](https://discourse.nodered.org/t/variable-instead-of-fixed-value/86563/3 "2024-06-17T15:00:27Z")

</div>

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