Note: I tried to post to best practices area but could not see how to label it for the post to go through. If this is in the wrong forum, let me know how to properly post in the correct forum. Thanks.
I struggled for some time on how to add a "Create New" and other options to a comboBox's dropdown list. I did not want to create another global collection in application especially since the scope of this entry is only needed in the comobox.
I could not really find a way to do this without getting all sorts of data type mismatch errors so if anyone can find a cleaner solution please share.
The code below is for the items property in the comboBox. The Split function creates the lists of items from a string. based on a text deliminator. To add the "*Create New" option or any other option to the list, that option is appended to the string along with the deliminator used by Split.
The string used by Split, is a text dump of the list from a table via a function called Concat. I use Distinct and filter to only list unique entries that meet a criteria but Concat creates a string based on the field name and a deliminator. Since I am using Distinct, "Result" is the field name that Concat works on. The key to this solution is to use the same text deliminator by both Split and Concat. That way when Spit runs, it just sees the newly added options as values using the same deliminator.