# Delete part of an object in Context

**URL:** <https://discourse.nodered.org/t/delete-part-of-an-object-in-context/51371>\
**Category:** General\
**Created:** [22 September 2021 03:53 UTC](https://discourse.nodered.org/t/delete-part-of-an-object-in-context/51371 "2021-09-22T03:53:23Z")\
**Posts on this page:** 1\
**Showing post:** 10

<div class="post-metadata">

**Author:** ![UnborN](https://avatars.discourse-cdn.com/v4/letter/u/4491bb/32.png) [@UnborN](https://discourse.nodered.org/u/UnborN)\
**Post date:** [23 September 2021 03:08 UTC](https://discourse.nodered.org/t/delete-part-of-an-object-in-context/51371/10 "2021-09-23T03:08:13Z")

</div>

my bad, i should have tested it more thoroughly ..  
it seems the `[]` syntax doesnt work when setting Context for **Objects**.  
the code should have been  
`global.set("Battery.SBP-Right.DesiredChargeRate", undefined);`

which was a bit confusing because in javascript when you have the special dash / minus `-` character in the property name you need to use the `[]` syntax so i presumed that it would work.

**Test Flow**

```auto
[{"id":"75f5e3b9b7132219","type":"inject","z":"4895ea10b4ee9ead","name":"set","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":270,"y":300,"wires":[["41b4634b728fe281"]]},{"id":"41b4634b728fe281","type":"function","z":"4895ea10b4ee9ead","name":"","func":"global.set(\"test.SBP-Right.DesiredChargeRate\", 123);\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":430,"y":300,"wires":[[]]},{"id":"7b6697bcbf49b32e","type":"inject","z":"4895ea10b4ee9ead","name":"del","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":270,"y":360,"wires":[["b30bc3a7fc1eb202"]]},{"id":"b30bc3a7fc1eb202","type":"function","z":"4895ea10b4ee9ead","name":"","func":"global.set(\"test.SBP-Right.DesiredChargeRate\", undefined);\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":430,"y":360,"wires":[[]]}]

```

Found the post i read about setting to `undefined`. it was [here](https://discourse.nodered.org/t/how-to-delete-a-flow-variable-from-a-function-node/19731/2)

---

_[View the full topic](https://discourse.nodered.org/t/delete-part-of-an-object-in-context/51371)._
