Homey Community Forum

Adding a slash into variable better logic

I am trying to add a slash(/) into a better logic variable. This doesn’t work. When i run this script it works when i delete the slash, and it doesn’t work when i add the slash.
Any ideas how i can solve this?

Forget to add the Slash and use the next line to store the variable:
let result=BLApp.apiPut("RadioDag" + nummer + "/" + "%2F" + randomNumber);

Is not exactly what i ment. I that case it adds a slash, which I need, but…

I want to add to the variable the next line;

http://192.168.178.2:5005/woonkamer/spotify/now/spotify:user:spotify:playlist: ”The id off the spotify playlist”

Or:
http://192.168.178.2:5005/woonkamer/favorite/ “The Sonos favorite”

So therefore i need to add the whole line with slashes in the variable nums. But because it are two complete different lines, your solution does not work for this case

Don’t get the picture, my solution gives the backslash before the Radio names in the BL-variables, that was what you asked, if I understood you right?
The rest you do probably in your flows, don’t you?

No quite. I have some radiostations, in that case the line is http://192.168.178.2:5005/woonkamer/favorite/
But i also have added some Spotify playlists and the line for those is http://192.168.178.2:5005/woonkamer/spotify/now/spotify:user:spotify:playlist:

I have tried to get it right with some flows, but for no reason at all it does not work for the playlists. So therefore trying to add the whole nescessary line in the variables

OK, the example was not completely what you wanted,
in that case you can easily replace the slashes with %2F like
nums = ["%2FRadio1","%2FRadio2"

Thx will try this. Will also try to formulate my question in future somewhat better😊