Salesforce

How Do I Refresh the Variable`s Value After Returning from a Selection Program Opened by an Event? (Magic xpa 4.x)

« Go Back

Information

 
Created BySalesforce Service User
Approval Process StatusPublished
Objective
Description

How Do I Refresh the Variable’s Value After Returning from a Selection Program Opened by an Event? (Magic xpa 4.x)

When you are working in a handler, the values of the variables are not actually updated until you leave the handler. That means, if virtuals are updated within a handler that is tied to a field, the values do not show up onscreen to the user until the user leaves the field.

This is particularly an issue when you are using selection lists. Typically the selection list is accessed by the user zooming from a field. Here we will show you the various options you have for implementing these zoom fields.

The problem: field doesn’t refresh

First, here is the kind of zoom that will not work properly. When the user is parked on the StudioCode control, it brings up a selection list, and the user can select a studio. But the field will still show blank, until the user moves to the next field.

Solution 1: Using the Force Exit Event property

Here is the solution to making the field update.

  1. A new event is created, which we named e.Zoom with Force Exit. This event is triggered by the zoom event, so it works like a zoom. However, the Force Exit property, on the right, is set to Editing. This forces the field to refresh itself.

  2. The new event is used in place of the internal zoom event.

You can create this new event in the Main Program so it is global to the application.

Note: Normally when you are parked on a zoom field, the word “zoom” appears on the Magic xpa status bar at runtime, as a prompt to the user. When you use this method, the “zoom” prompt will still appear, because a zoom trigger is being used on the event.

Hint: If you want to replicate the action of a zoom after, then add a Raise Event for the Internal Event “Next Field”.

Solution 2: Attach the selection list to the control

Alternatively, you don’t need to use an event at all for a selection list. You can simply use the Select Program property for the field.

You can attach the program at the Model level, or at the Control level on the form. Either way, a zoom will call the selection program.

This has the advantage that you don’t need to specify this in every task. In our example, the Model for “Studio code” will always call the “Select Studio” program unless we break the link.

The disadvantage of this method is that it only works for selection lists that send back only one variable. In this example, we are only selecting the “Studio code”. But if we needed to select a “Studio code” and a “Studio type”, we would need to use an event.

Solution 3: Use a Combo box

With Magic xpa, you can also just use a drop-down list, for many selection lists. Again, you can define this at a Model level, so you don’t need to do it in every program. In this example, we created a Model called Studio Pulldown, which shows as a Combo box and is automatically linked to the Studio table. All we need to do now is to use this model for the Studio code.

See also

The Online and Rich Client Samples projects (program EH01 and REH01)

Reference
Attachment 
Attachment