Variables value lost after preparation

  
Hi I'm having a problem similar to https://www.outsystems.com/forums/discussion/9586/variables-values-lost-suddenly/ i think.

I have a webscreen with a preparation where, if a query returns only 1 in the .count attribute i want to auto fill some fields for the user.




At the end of preparation the values still and are correct.




But when it jumps to actually build the page the values are lost/reseted and the edit record fields are empty.




I'm wondering as why this happens.
Hi Pedro,

Like I replied on the other thread it looks like the normal optimizer behavior, unless you are using the attributes in your actions or screen they will be optimized if they are not necessary in the logic and will not show in the debugger.

So: are you actually seing any problem on your page caused by this? Or just wondering by looking at that on the debugger?

Regards,
João Rosado
The edit record is visible in the webscreen (and mandatory)  so i am actually seing the problem.
The fields are empty with the said query returning a count of 1 or not. It is not a big problem in this application because there is a combo that sums up all the customerpoints available, it was just that little touch that makes sense to have, i.e. if the client only have one makes sense that the fields are completed with that information when the page loads.

These fields are actually the first thing that have to be filled by the client.

Pedro Barros
Ha, sorry I see.
Got a bit confused since I was thinking it was a related post.

In your case it is different problem.
You are assigning the MoradaEnvio.Record, but that variable at the end of the preparation will be replaced with the variables of the variable that you have selected as "Source Record"  (I'm assuming you have one filled, can't see it on your screenshots)
If you have it setted, can you try to set that variable instead of the MoradaEnvio.Record?

On a side note, performance wise you should use the GetCustomerPoint.List.Length instead of the GetCustomerPoint.Count. The Count is to be used for pagination purposes and actually forces 2 queries to be done to the database, one to get the data and another to get the count.

Regards,
João Rosado
You are correct. By filling the variable that is the source of the edit record the values get passed from preparation to page build and are correctly displayed. Thanks a lot João!

Ps: I did not know about that little performance trick. Thanks once more.
Any more tricks to boost performance or a page with some of them?