States not updating with asigned variable

Hi Antti,
why if i place in your example a text field linked ti the data slot variable ds_trafficLightState
in data runtime linkage text value property
the text field does not change the value?
this is important to make editing forms …
regards Paolo

(Text fileds value from dataslot not update itself)

I think the problem is that if the same input field is set to save the state to Data slot and then update its content from same state then there would be infinite loop causing the whole app to crash. That’s probably the reason why input fields update only when you load the screen.

can you make an example?
i have no data slot in input field save event!!

Yes the state gets the value from props and if props change then the state changes as well. It does not mater where the data is fetched. You just need to make sure that the Data sheet is updated and also that the data is passed to props. Basically easiest way is to debug the code from browser’s Web developer tools (Google developer tools debug javascript). You can also add text label to screen and connect that to same “state variable” and see if the text in label changes.

P.S. You probably need to have some developer mindset or understanding about the React to make things with the Studio. The main idea is that it generates code and it’s almost necessary that one understands the basics of React development or it get’s really complicated. The Studio is not ‘no-code’ tool it’s more of an ‘low-code’ tool. Anyway you’ll learn a lot by checking the Studio generated code.

1 Like

I am very surprised by your answer! …
Please see the email that i have sent you!

If one sets “When user edits text” -> Save to data slot (Same data slot which is used as value for the same textfield)

At the moment we cannot restrict the Studio UI to prevent this possible collision. @juha_neonto any thoughts about this?

I understand possibles collisions but I do not agree with the restriction to update a input text fields with some dynamic data! also when the screen is loaded! this is an elementary thing!

My understanding is that If input field would listen the state all the time then it would be uneditable. The value would always be overwritten to the value in state so user could not edit the field value and there’s no reason to use input field instead of text label etc. for showing the value in state.

I’m not an expert in React so let’s wait what Juha says on this.

P.S. I found this article related tho the matter:

this is exactly what i think

Exactly @Antti_Neonto! The way react.js works makes this a bit more complex than it should be. Of course it can be implemented with some extra logic but with our current implementation the restriction is that text fields update from data linkages only when a screen is opened.

Ok, but in this post

you wrote something different. or did I read wrong?
excuse me…

Ah, you are correct! Data slot data linkage + same data slot in Save data… -interaction is a special case that supports fully dynamic updates. So if you can work with data slots then that’s the solution.

but it does not wotks…see my email

Ok, now I get it. In addition to data slot data linkage you should set the save data interaction using the same data slot

If you do those things it should work.

1 Like

Yes, this way it works.

Thanks, all. First, how do I use the developer tools to confirm the values are moving through correctly? I think that might be a problem with another bug I’m addressing.

Second, could you confirm that any ordinal, value on the data sheet, starting with zero, can trigger changes in states? “Override state using data linkage” allows for values from Data Slots, from other sheets, and from Carried Properties. I’ve tried to assign values from other sheets and Carried Properties to this field, but I’m not getting fraction.

Thanks again.

Are you sure that the component props really have the data? I mean it doesn’t work if you just create props but you don’t set the data by using list or adding Data sheet as screen data source.

Here’s quick example app:

If you change the value from 0 to 2 the row’s state changes (bg color changes).

Sorry to drop off. I do have data sheets set up, and have set the states to use the associated data. At this point, from what you’ve said, it must be a variable that isn’t carrying over. I’m having a problem with some values carrying through and others not, so I need to find help with popping the hood to see what’s not working the way it should.

Just a heads up on this topic. We released an update which adds extra logic to code with input fields. If user has not edited the field value it will update itself if the value is bind to state.

Thanks for the update! I’ll take a look soon. Have a great weekend.