Form not holding values from source record

Form not holding values from source record

  

I have been having this recurring issue lately, where I assign as a the source record of a form a given structure, and then on the inputs inside the form I assign the variable as: "FormName".Record."Attribute", but when I load the page where the form is, the input fields are empty even though the debugger shows that the record has the data I'm expecting on it.

Anyone else with this issue or knows what might be happening?

Hello João

Can you provide a sample .oml to help the community understand the issue?


Regards,

Ângelo

Hi Ângelo, 

I can't provide the .oml I'm working on. I could however try to reproduce the issue in another .oml, but this is an issue that doesn't allways occur, meaning I might not be able to reproduce it...

Hi João,

It's indeed difficult to say what's wrong without seeing your code. At what stage do you fill the source record with data? I assume in the Preperation?

João,

Is this Mobile or Web?
The "structure" is a local variable? A session variable?
From where is comming the data, from the current of an aggregate/sql? From another place?

For example, if you try to force values in the Record Variables of the Form, in the preparation, they will be erased when the Form is built, because it will look for data in the source (than, if you want to set something, you must set in the source, not in the records itself, in the preparation).

But like was said, without looking to the code, or a better explanation (with pictures, etc), it is just guessing.

Cheers,
Eduardo Jauch  

The form is inside a weblock and is being fed by an input parameter of that weblock. 

This is a picture of the input parameter while debugging the preparation:

Here you can see that the CancellationPolicy has a value set to it.


And here is the pic of the debugger while rendering the weblock:

As you can see, on the Form.Record the CancellationPolicy is now set to "0". This behaviour happens as well for other parameters in the form.

Hi João,

Just a question,

Are you USING this "CancellationPolicy" variable in the form, like, in a field? If not, this can be just the debugger ignoring the attribute because of optimization.

Or the form really is without values when the screen is shown?

Also, did you provide the input parameter directly as the source of the Form or the source is a different one and you are trying to set its record values in preparation? In the second case, you would lose the values during the rendering of the form, as it would update any changed record attributes with those from the source.

Cheers,
Eduardo Jauch 


Regarding the "CancellationPolicy", we are not using it on the form, but we have a similar variable that we are using in the form which value is also set to 0.

On your other question, we are feeding directly the form from the input record (values are comming pre-set

Regards,

Chastre

Hum...

Even if an attribute is currently set to an input, if you are not using it anywhere else, optimizations may be ignoring it...

Is you doing anything with the Form record?
Like using it to save to database?

Would you be able to reproduce in a simpler OML this behaviour?

Cheers,
Eduardo Jauch

Yes i'm using the record to save data from it to the database.

I've tried to reproduce it in a simpler OML but it is working as expected and I can't reproduce the bug.

One work around was to assign to the form a local variable and then use on the inputs the attributes from that local variable instead of the Form.Record attributes, but I do understand this is not the way I should be working with the form...

Regards,

Chastre


Hello João,

Yes, the advisable way is to use the record.
What is the page structure?

Page -> layout -> web block -> form?

Or the web block is inside other thing, like other form, etc?

P.S. I remember, some time ago, of something similar, in that the compiler didn't understood that I do was using the variable and was optimizing it, than I had to use this workaround. What is the version of the Service Studio and your platform?

The page structure is Page -> layout -> web block -> form -> columns2 (silk ui) -> panel -> labels input fields.

I even experimented removing the columns2 and the panel between the input fields and the form, but they still came blank.

Platform 10, Service Studio version 10.0.717.0


Hi João,

What if you assign the result of the query to the form record variable just after the query?

Does that do the trick?

Cheer,