Normal Topic PopulateListElement from file not working (Read 399 times)
Rod Weston
Member
*
Offline



Posts: 25
Joined: Aug 22nd, 2016
PopulateListElement from file not working
Sep 1st, 2016 at 5:59pm
Print Post Print Post  
I have the following code in Global Code
Code
Select All
Stat sCountryList as String
Stat sCountryList2 as String
Stat sCountryList3 as String
// Get all contacts from Country form
sCountryList = @XlistValues(@FN, "Country!Country")
// Initialize the Array with unique sorted values
sCountryList2 = @SortStringArray(sCountryList, 0)
sCountryList3 = @UniqueStringArray(sCountryList2)
sCountryList = ""
sCountryList2 = ""
 



and then at the actual Country0 LayoutElement I have:
Code
Select All
PopulateListElement(Country0, sCountryList3) 



When I test the code, no errors are listed, but when I try to use the form, nothing is loaded in the combo box. I have tried loading the combo box values in other Layout Elements as well, but it still doesn't work. What did I do wrong? More importantly, what troubleshooting techniques could I use so I can see what I did wrong?
  
Back to top
 
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: PopulateListElement from file not working
Reply #1 - Sep 1st, 2016 at 7:31pm
Print Post Print Post  
In answer to your second question ("what troubleshooting techniques...?), you should insert "writeln" statements in your code, so you can see the values being set and the what code is being run.

In general, you probably want to reserve the Global Code space for variable, subroutine, and function declarations that are used by two or more other events.

To debug this, fill this routine and the routines using these variables up with writeln statements. You should also try populating your list element with hard-coded values, so you can see if the problem is in the  routine that gets the data from the engine, or the routine that puts it in the list element. You might also call @error/@errortype/@errorstring between built-in functions to see if the last function failed -- displaying the error with writeln.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged