I have the following code on the OnChange of a dropdown control.
UpdateContext(
{
vSite: ddSiteCode.Selected.Value,
vDateKey: Value(
Text(
dteEffectiveDate.SelectedDate,
"[$-en-US]yyyymmdd"
)
),
vSiteKey: LookUp(
UsersAndSites,
Site_Code = vSite
).Site_Key
}
);
Set(
gDebugText,
Concatenate(
gDebugText,
gRET,
"vSite = ",
vSite,
gRET,
"vSiteKey = ",
Text(vSiteKey),
gRET,
"Lookup = ",
Text(
LookUp(
UsersAndSites,
Site_Code = vSite
).Site_Key
)
)
);vSite and vDateKey get set correctly, but vSiteKey is delayed updating. The Lookup show the correct value.
For instance if I have these valuse in the collection UsersAndSites:
Site_Code Site_Key User_Name
MAC6 154 JohnS
MAC9 728 PhilK
WLDD 503 CarolB
I have a multiline textbox control set to display the contents of global variable gDebugText.
The first time I change the dropdown and pick "MAC6".
The second time I select "MAC9".
The thrid time I select "WLDD".
This is what the gDebugText shows. I have seperated each dropdown change with a double line:
==============
vSite = MAC6
vSiteKey = 0
Lookup = 154
==============
vSite = MAC9
vSiteKey = 154
Lookup = 728
==============
vSite = WLDD
vSiteKey = 154
Lookup = 503
==============
vSiteKey updated on the second OnChange to what it should have been on the first OnChange. Every OnChange after that, it would not update and stayed at 154. vSite and vDateKey are updating correctly as are the other context variables in my app, as far as I have found so far.
HELP!