How to reset the context store variable

Hi
I am using context variable to store the two values in an flow that i am able to store it ,
i need help in how reset the data stored in context variable
I Have Attached my flow below

[{"id":"aa4e304feff52ade","type":"tab","label":"Flow 1","disabled":false,"info":"","env":[]},{"id":"b729f09bd2d6ebe8","type":"debug","z":"aa4e304feff52ade","name":"debug 2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":620,"y":140,"wires":[]},{"id":"cac01e08e6b2795d","type":"inject","z":"aa4e304feff52ade","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[\"ohm114\"]","payloadType":"json","x":200,"y":140,"wires":[["301be4b76ba7e422"]]},{"id":"301be4b76ba7e422","type":"function","z":"aa4e304feff52ade","name":"Store and foward","func":"let store = context.get('store') || {}\n\nObject.assign (store, msg.payload)\n\ncontext.set('store', store); \n\nmsg.payload = store;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":410,"y":140,"wires":[["b729f09bd2d6ebe8"]]},{"id":"ca79c7ca4a9c4e5b","type":"inject","z":"aa4e304feff52ade","name":"","props":[{"p":"payload.id","v":"[\"axc123\"]","vt":"json"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":210,"y":200,"wires":[["301be4b76ba7e422"]]}]

Thank you

you can use delete store to reset full store or delete store.id to reset id, or context.set("store", undefined) to reset the full store, or context.set("store.id", undefined) to reset id.
e.g.

[{"id":"cac01e08e6b2795d","type":"inject","z":"aa4e304feff52ade","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[\"ohm114\"]","payloadType":"json","x":200,"y":140,"wires":[["301be4b76ba7e422"]]},{"id":"301be4b76ba7e422","type":"function","z":"aa4e304feff52ade","name":"Store and foward","func":"let store = context.get('store') || {}\nif(msg.delete){\n    delete store[msg.delete];\n}else{\nObject.assign (store, msg.payload)\n}\ncontext.set('store', store); \n\nmsg.payload = store;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":410,"y":140,"wires":[["b729f09bd2d6ebe8"]]},{"id":"ca79c7ca4a9c4e5b","type":"inject","z":"aa4e304feff52ade","name":"","props":[{"p":"payload.id","v":"[\"axc123\"]","vt":"json"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"str","x":190,"y":180,"wires":[["301be4b76ba7e422"]]},{"id":"b17d678a.cb8418","type":"inject","z":"aa4e304feff52ade","name":"delete id","props":[{"p":"delete","v":"id","vt":"str"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":190,"y":260,"wires":[["301be4b76ba7e422"]]},{"id":"bfe9d959.0f4958","type":"inject","z":"aa4e304feff52ade","name":"delete 0","props":[{"p":"delete","v":"0","vt":"str"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":200,"y":300,"wires":[["301be4b76ba7e422"]]},{"id":"b729f09bd2d6ebe8","type":"debug","z":"aa4e304feff52ade","name":"debug 2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":620,"y":140,"wires":[]}]

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