I’m just stuck for a very long time with this issue. I have an api GET on server-side. The api returns key-value pairs where some of the keys (variables) have spaces, like this.
On client-side,
when I bind a variable that has no space in its name, the value is showing up correctly, like this.
but, when I bind a variable that has a space in its name, the value is not showing up, instead the variable name is getting displayed! Ideally the value 96175 must be displayed as Order ID.
I notice that wappler encloses such variables within single quotes & square brackets.
I tried renaming the variables on server-side in the schema. But, when I try binding the renamed variable, no value but this time, not showing the variable name also!
Is this a bug, may be? Any help will be greatly appreciated! Thanks!
(1)Please first check the network tab in the debugger.
What do you see there as value for the variable with the space.
(2)Dont know if this will work just try to convert the variable into a number with the formatter
Thanks mate. I did check the network tab on my browser, definitely has a value. I can’t just convert it to number, as there are other similar variables (with their names having spaces) that has text values (that has to be printed as string).
Spaces are not allowed in identifiers, so {{Order ID}} will give an parse error.
Using brackets like in {{['Order ID']}} will result in an array with Order ID as a string value. When using it on the page it will convert the array to string resulting you seeing Order ID on the page.
You can use brackets, but you need to know the parent component. When in a repeater you could probably use {{$value['Order ID']}}.