# Set Logic variable by NAME?

**URL:** <https://community.homey.app/t/set-logic-variable-by-name/117888>\
**Category:** Questions & Help\
**Tags:** homeyscript, homey-pro\
**Created:** [October 11, 2024, 11:23am UTC](https://community.homey.app/t/set-logic-variable-by-name/117888 "2024-10-11T11:23:55Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![Pat\_M](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/pat_m/32/56295_2.png) [@Pat\_M](https://community.homey.app/u/Pat_M)\
**Post date:** [October 12, 2024, 2:10pm UTC](https://community.homey.app/t/set-logic-variable-by-name/117888/5 "2024-10-12T14:10:34Z")

</div>

Hi again, thanks for all input.

Here is my current script:

```auto
let testDay = new Date();
let dateNum = testDay.getDate();
let monthTxtShort = testDay.toLocaleString('fefault', { month: 'short'})

let TodaysDate = Object.values(await Homey.logic.getVariables()).find(({name}) => name === "TodaysDate");
let TodaysDateId = TodaysDate.id
let MonthTextShort = Object.values(await Homey.logic.getVariables()).find(({name}) => name === "MonthTextShort");
let MonthTextShortId = MonthTextShort.id

Homey.logic.updateVariable({id: TodaysDateId, variable: {'value' : dateNum}} )
Homey.logic.updateVariable({id: MonthTextShortId, variable: {'value' : monthTxtShort}} )

```

I just find it awkard to first have to get the ID of the variable. Is it because (which seems fair) you can have multiple variables with the same name and ID is the only key?

Thanks!

---

_[View the full topic](https://community.homey.app/t/set-logic-variable-by-name/117888)._
