I have several web popups in use on an app. When entering data to create a new employee record, for instance, they work perfectly. They populate with the appropriate source data and pass the selected data to the database when referenced.
When going to the other way, however, as we populating a popup with data from an existing database record, they do not display the appropriate information.
I have verified I am getting the info to put into the popup, but it’s not showing up - nor is it throwing an error.
Example code that is not working:
If result.HasKey("rate_ins") Then
If result.value ("rate_ins") <> Nil Then
insRatePU.Text = result.value ("rate_ins") // this is where I am trying to set the value I want displayed (selected) in a webpopup.
I would just use a text field but I want the user to be able to select a different value for a number of items and update the database with the new information. What am I missing here?
**I have also removed the “delete all rows” when populating the lists! We found there were some bugs with web popups at some time in the past that were related to that.
Well, according to the documentation WebPopupMenu.Text is a read only property, so you shouldn’t be surprised. For WebPopupMenu there’s a helper function built in which will save you some time finding the index of the string you’ve stored.
This code is written based on assuming
result is a Dictionary since that’s the only thing I know of off the top of my head with a
HasKey function. Based on this assumption, I’ve simplified the code using
dim sStoredRate as String = result.Lookup("rate_ins", "DefaultValue")
dim iDesiredIndex as Integer = insRatePU.IndexOfRow(sStoredRate)
if iDesiredIndex > -1 then
insRatePU.ListIndex = iDesiredIndex
This code was written in the post editor, is subject to typos, and is provided only for illustrative purposes. Who knows, it might not even work at all.
Thank you Tim! While implementing your code I also discovered I had an “event conflict” for lack of a better term. I was firing a Shown even to populate the popup with selection data and I was trying to simultaneously populate the popup with the data returned from the database. No bueno. I switched the popup row population to an open event and used your code. Works like a charm. TYVM.