Variable value comes as [object Object]

I should normally get this but I couldn’t. When I click on a widget I want its text value to change another text label (which is fine) and also set the variable value.

Then I update rows and I want that variable value to go into the rows. I also put a test text widget to write the same variable value. In both places I get [objectObject] as the value of variable.

I tried both [[This]] or [[This.text]] on onclick of the widget to write its text value to variable. Both didn’t work. But why it works on changing the text label but not writing variable?!

What does [object Object] mean? Is it because the widget with onClick is also a master?

I just created another variable and it seems that the new one is getting the value.
Although [[This]] still didn’t work and returned [object Object] but [[This.Text]] as I assumed is working.
I would say variable was corrupted but it takes the first assigned value with onLoad.

Hi tekin,

Thanks for posting about this. I see what you mean, and I agree this behavior could be made a little more clear. At the moment, using [[this.text]] would be the more standard way to refer to the text on ‘this’ widget. And while it’s certainly possible to simply refer to the widget as an object (e.g. via [[this]]) when you’re setting text, doing so isn’t sufficient when setting a variable value. This is an interesting point, though, and we’ll continue to track this issue going forward. Thank you!

Is there a way around this yet? I have a multi-page repeater with 1 row per page and I want to set a variable to the value of the last element in the row when I click a button, but I either have the “object Object” issue or it just sets it to “[[This.Amount]]” (Amount is the name of the thing that I am trying to read). I don’t care how sketchy of a solution it is, I will take anything.

Hmm, is the button that is setting the value of the variable inside of the repeater row, or is it outside of the repeater? If it’s inside, and the widget that’s getting clicked has the value that you want to set to the variable on it, then using either “Set Variable value to text on widget This” or “Set Variable value to value [[This.text]]” should do the trick to set the variable value to the text, rather than giving you [Object Object] as the output.

If that doesn’t seem to do the trick, would you mind posting the file or a sample that shows your setup so that we can take a look at what’s causing the output to render as [Object Object]? Thanks!