Creating a drop-down Customer list to allow Users to choose contacts in other Forms
You may want to use something along these lines:
Var vList as String // Get all contacts from Contact form vList = @XlistValues(@FN, "Contacts!Contacts") // Initialize the Combo Box with unique sorted values PopulateListElement(TransName, @UniqueStringArray(@SortStringArray(vList,0)))
However, It is often a good idea to use variables in cases where you could (but probably shouldn't) nest functions. By using intervening string variables, you can use WriteLn to see the values of the variable during development to make sure that each step of the procedure is running the way you want it to:
Var vList as String Var vList2 as String Var vList3 as String // Get all contacts from Contact form vList = @XlistValues(@FN, "Contacts!Contacts") // Initialzie the Combo Box with unique sorted values vList2 = @SortStringArray(vList, 0) vList3 = @UniqueStringArray(vList2) PopulateListElement(TransName, vList3)
It adds visual clarity to the code, and makes it easier to debug. It may run a bit slower, but can be easily optimized after you know that it's working. Variables are many times faster and safer than elements. Only use an element to get the value initially, or to write the final result back.