pageVars inside http Request body

I want to change the status of a room through a http request but its not working


If i enter the room number manually it works but not with a varriable !

Hi @Bilel_Tlili , if you put quotation marks around a page variable reference it is evaluated as a string

If roomNumber: text = "4"

Formula {pageVars.roomNumber: true} will evaluate to {"4": true}

Formula {"pageVars.roomNumber": true} will evaluate to {"pageVars.roomNumber": true}

heres exactly the situation:

I want to send a (http request - Put) to update the status of a room (Occupied/Free) inside my data class.

I made a pageVars.RoomNumber and the value will be set depending of the user selection.
ans another pageVars.RoomStatus as boolean to switch between (Occupied or Free)
so the formula i scripted in the body request is:

{“pageVars.RoomNumber”:pageVars.RoomStatus} ----> Not working !

‘{"’ + pageVars.RoomNumber+’":pageVars.RoomStatus}’ ----> Not working !

it workis only is i put it manually, like:

{“201”:pageVars.RoomStatus} ----> It works

but the selection of the room is a GUI to be stylish for users

Hi, depending on what format your request body is in either "{" + pageVars.RoomNumber + ":" + pageVars.RoomStatus + "}" (string) or {pageVars.RoomNumber: pageVars.RoomStatus} (object) should work.

When in web preview, you can use the Network tab in Chrome (right-click → “Inspect”) to see the requests your app is sending and debug their content. :slight_smile:

Appgyver do not accept it i can’t save it to apply it, also the string method its not working

Can you post a screenshot of the error you receive in the Formula editor?

Here it is

Sans titre

1 Like

and this is the formula editor

Try SET_KEY({}, pageVars.RoomNumber, pageVars.RoomStatus) to create the object




Haha! I am glad I got this conversation going in the right direction :slight_smile: