# Adding a slash into variable better logic

**URL:** <https://community.homey.app/t/adding-a-slash-into-variable-better-logic/34206>\
**Category:** Developers\
**Created:** [August 31, 2020, 12:12pm UTC](https://community.homey.app/t/adding-a-slash-into-variable-better-logic/34206 "2020-08-31T12:12:07Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marcel\_Ubels](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/marcel_ubels/32/18860_2.png) [@Marcel\_Ubels](https://community.homey.app/u/Marcel_Ubels)\
**Post date:** [August 31, 2020, 12:12pm UTC](https://community.homey.app/t/adding-a-slash-into-variable-better-logic/34206/1 "2020-08-31T12:12:07Z")

</div>

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?

 ![Aantekening 2020-08-31 140826](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/3/6/364474b5f12698575630f2a43fc2c661e4cd26f3.png)

---

<div class="post-metadata">

**Author:** ![JPe4619](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jpe4619/32/9017_2.png) [@JPe4619](https://community.homey.app/u/JPe4619)\
**Post date:** [August 31, 2020, 1:02pm UTC](https://community.homey.app/t/adding-a-slash-into-variable-better-logic/34206/2 "2020-08-31T13:02:21Z")

</div>

> [@Marcel\_Ubels](#):
>
> to add a slash(/)

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

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/5/1/517c5d32fabebdaa814c1ed210473c0ece4707b3.png)

---

<div class="post-metadata">

**Author:** ![Marcel\_Ubels](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/marcel_ubels/32/18860_2.png) [@Marcel\_Ubels](https://community.homey.app/u/Marcel_Ubels)\
**Post date:** [August 31, 2020, 1:56pm UTC](https://community.homey.app/t/adding-a-slash-into-variable-better-logic/34206/3 "2020-08-31T13:56:14Z")

</div>

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:](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/](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

---

<div class="post-metadata">

**Author:** ![JPe4619](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jpe4619/32/9017_2.png) [@JPe4619](https://community.homey.app/u/JPe4619)\
**Post date:** [August 31, 2020, 2:07pm UTC](https://community.homey.app/t/adding-a-slash-into-variable-better-logic/34206/4 "2020-08-31T14:07:24Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Marcel\_Ubels](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/marcel_ubels/32/18860_2.png) [@Marcel\_Ubels](https://community.homey.app/u/Marcel_Ubels)\
**Post date:** [August 31, 2020, 2:15pm UTC](https://community.homey.app/t/adding-a-slash-into-variable-better-logic/34206/5 "2020-08-31T14:15:32Z")

</div>

No quite. I have some radiostations, in that case the line is [http://192.168.178.2:5005/woonkamer/favorite/](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:](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

---

<div class="post-metadata">

**Author:** ![JPe4619](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jpe4619/32/9017_2.png) [@JPe4619](https://community.homey.app/u/JPe4619)\
**Post date:** [August 31, 2020, 2:20pm UTC](https://community.homey.app/t/adding-a-slash-into-variable-better-logic/34206/6 "2020-08-31T14:20:18Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Marcel\_Ubels](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/marcel_ubels/32/18860_2.png) [@Marcel\_Ubels](https://community.homey.app/u/Marcel_Ubels)\
**Post date:** [August 31, 2020, 2:33pm UTC](https://community.homey.app/t/adding-a-slash-into-variable-better-logic/34206/7 "2020-08-31T14:33:12Z")

</div>

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