Template-node error

I am trying to pass the content of a global variable to an HTTP-in node
In my template node I have the following:

{
Learning status: {{global.get("LearningStatus")}}
}

but it is giving error when the request is sent to the HTTP-in node.
"Invalid property expression: unexpected " at position 4"

How can I pass the value of the global variable to the template node in the correct way?
Thanks for helping.

Properties can not contain spaces, not sure if this is the source of the error but that should be solved at least.

Thanks for highlighting the typo. I corrected it but the problem is still the same.
it reads like this now:

{
Learning_status:{{global.get("LearningStatus")}}
}

Invalid property expression: unexpected " at position 4

In a template node it would be

{
Learning_status: {{global.LearningStatus}}
}

and if you wanted valid json
it would be

{
"Learning_status": "{{global.LearningStatus}}"
}

Depending thee value of global.learningStatus.

Thank you.
I don't get errors anymore but still I cannot get the value of the global.LearningStatus.
I get "Learning_status": "[object Object]" rather than the real value which is "Process stopped" or "Process started".
I tested the value of the global.LearningStatus and it is correct. I tested both the code you suggested but same result. Not sure about what this issue is now.

Then global.learning_status is an object. Show us the global value in the sidebar.

Screenshot 2022-09-17 at 15.50.00

That is not the context sidebar that is the debug sidebar. We need to see what the global is set at.

[{"id":"ee1921195e1f3b6c","type":"status","z":"c77ba1683e345234","name":"ExecStatus","scope":["c4ff59a7c876123f"],"x":1050,"y":720,"wires":[["d78095b461723415"]]},{"id":"d78095b461723415","type":"function","z":"c77ba1683e345234","name":"CheckStatus","func":"\nvar test = msg.status.text;\n\nif (test.includes('pid:')) { \n  msg.payload=\"Process running\"\n}\n\nelse if (test.includes('kill')) { \n  msg.payload=\"Process stopped\"\n}\n\nelse {\n    msg.payload=\"Unknow process status\"\n}\nmsg.topic=\"Learnig status\";\nmsg.payload={\"Status\":msg.payload, \"Topic\":msg.topic};\n\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1250,"y":720,"wires":[["ab3735fbdb4de2c8"]]},{"id":"ede1db84ccbe2c51","type":"http in","z":"c77ba1683e345234","name":"Input from KIosk","url":"/api/learningstatus","method":"get","upload":false,"swaggerDoc":"","x":1060,"y":800,"wires":[["4270a9372c1fbbe5"]]},{"id":"4135fe289f5c7d33","type":"http response","z":"c77ba1683e345234","name":"","statusCode":"200","headers":{},"x":1420,"y":800,"wires":[]},{"id":"4270a9372c1fbbe5","type":"template","z":"c77ba1683e345234","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"\"Learning_status\": \"{{global.LearningStatus}}\"\n","output":"str","x":1240,"y":800,"wires":[["4135fe289f5c7d33"]]},{"id":"ab3735fbdb4de2c8","type":"change","z":"c77ba1683e345234","name":"","rules":[{"t":"set","p":"LearningStatus","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1450,"y":720,"wires":[["bfe334ed56797848"]]},{"id":"bfe334ed56797848","type":"debug","z":"c77ba1683e345234","name":"Var from setting","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1680,"y":720,"wires":[]}]

Again that is a change node, we need to see the context sidebar . at top of the sidebar select the icon that looks like 3 coins and then refresh global and show us the result.

[edit]
I suspect it is global.learningStatus.Status.
in your change node you should of set
global.learningStatus
to
msg.payload.Status.
If you wanted the value at global.learningStatus

Sorry for that... :face_with_diagonal_mouth:. I think you asking for this :

see my edited post above.

In the template node now I have

"Learning_status": "{{global.LearningStatus.status}}"

In the change node I have set the variable to msg.payload.status
If I send the request I get: "Learning_status": ""
The value of the variable is not there yet. Sorry for bothering you with this

Capital S for Status in msg.payload.Status, and use global.learningStatus

Screenshot 2022-09-17 at 16.11.41

Not my day! I still get

what is in template and what is sidebar context showing? don't forget to refresh global context in sidebar.

I updated above with the template.

In the sidebar context there is always a value, Process stopped or process started

Do yo think you could show us, as we can not assume.

sure

[{"id":"ee1921195e1f3b6c","type":"status","z":"c77ba1683e345234","name":"ExecStatus","scope":["c4ff59a7c876123f"],"x":1050,"y":720,"wires":[["d78095b461723415"]]},{"id":"d78095b461723415","type":"function","z":"c77ba1683e345234","name":"CheckStatus","func":"\nvar test = msg.status.text;\n\nif (test.includes('pid:')) { \n  msg.payload=\"Process running\"\n}\n\nelse if (test.includes('kill')) { \n  msg.payload=\"Process stopped\"\n}\n\nelse {\n    msg.payload=\"Unknow process status\"\n}\nmsg.topic=\"Learnig status\";\nmsg.payload={\"Status\":msg.payload, \"Topic\":msg.topic};\n\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1250,"y":720,"wires":[["ab3735fbdb4de2c8"]]},{"id":"ede1db84ccbe2c51","type":"http in","z":"c77ba1683e345234","name":"Input from KIosk","url":"/api/learningstatus","method":"get","upload":false,"swaggerDoc":"","x":1060,"y":760,"wires":[["4270a9372c1fbbe5"]]},{"id":"4135fe289f5c7d33","type":"http response","z":"c77ba1683e345234","name":"","statusCode":"200","headers":{},"x":1420,"y":760,"wires":[]},{"id":"4270a9372c1fbbe5","type":"template","z":"c77ba1683e345234","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"\"Learning_status\": \"{{global.learningStatus}}\"\n","output":"str","x":1240,"y":760,"wires":[["4135fe289f5c7d33"]]},{"id":"ab3735fbdb4de2c8","type":"change","z":"c77ba1683e345234","name":"","rules":[{"t":"set","p":"LearningStatus","pt":"global","to":"payload.Status","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1450,"y":720,"wires":[["bfe334ed56797848"]]},{"id":"bfe334ed56797848","type":"debug","z":"c77ba1683e345234","name":"Var from setting","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1680,"y":720,"wires":[]}]