16
Views
5
Comments
Solved
Calculating the values of local variables in the preparation
Application Type
Traditional Web
Service Studio Version
11.10.0 (Build 34711)

Hi,

When navigating to the screen (extract shown below) and viewing data for a selected patient, the Weeks Post Surgery should show 5.6.  These are input fields on a form. They are attributes of an entity, except the Weeks Post Surgery, which is a local variable.  In the preparation I assign values to the local variables.

When entering the Surgery Date, the Weeks Post Surgery is calculated in the Onchange event of the Surgery Date.  This works correctly.  The problem is that the values of the database fields in the assignment statements is not available until after the “End” of the preparation. How do I access the values so I can calculate and assign the local variables when the form is first shown.

Thank you

Leon


Rank: #67
Solution

Hi Leon,


The form data comes from a query, meaning you have a form binded to a query, right?

In that case, you have 2 options:

  1. When assigning variables you use the query fields (which have values on the Preparation unlike the Form which has to be rendered first) to calculate them;
  2. You explicitly assign the Form to the value of the query before the assign of the local variables, so the Form fields have the value when you are calculating the local variables.


Hope it helps.


Regards,
João

Rank: #3681

João,

I implemented option 2, which solved the problem.


Thank you for your help.

mvp_badge
MVP
Rank: #75

Hi Leon,

If I understood the mentioned case correctly, I would suggest you to define the same OnChange assignment node (which includes calculations and assignment of the computed value to the PostSurgery Local variable) in the preparation action flow itself. Note that the Screen starts rendering after the execution of the preparation action flow gets completed.

Hope this helps you!


Kind regards,

Benjith Sam

Rank: #3681

Thank you Benjith.

I didn't quite understand your suggestion but I think you are saying the same thing as João Marques.  I implemented his suggestion and it solved my problem.

I appreciate your help.

mvp_badge
MVP
Rank: #75

You're welcome Leon :)

Glad that you got it solved :)


Kind regards,

Benjith Sam

Rank: #67
Solution

Hi Leon,


The form data comes from a query, meaning you have a form binded to a query, right?

In that case, you have 2 options:

  1. When assigning variables you use the query fields (which have values on the Preparation unlike the Form which has to be rendered first) to calculate them;
  2. You explicitly assign the Form to the value of the query before the assign of the local variables, so the Form fields have the value when you are calculating the local variables.


Hope it helps.


Regards,
João

Rank: #3681

João,

I implemented option 2, which solved the problem.


Thank you for your help.