Hello All,
I am wondering is there anything I need to know regarding drop downs and the way the form is initially loaded? The reason I ask, I wrote a function which should return a comma separated list -- which should populate a drop-down list. However, when I call the function that I get: ERROR: 32847 FUNCTION DEFINITION IS NOT EXECUTABLE in the MEL trace.
I tried using the function in a data display and it works fine. This made me think that the drop down is loaded at an earlier point the data display.
Any thoughts?
Thanks,
Brad
If your list I less than 2000 characters, you can use a ! to define the list at form load.
I've used this many times.
{! DOCUMENT.THISLIST = "1,2,3,4,5,6,7,8,9"}
Then in the drop down field, make sure you check the box on the right to make it a dynamic list.
In the field at the bottom put in {DOCUMENT.THISLIST}
That should do it.
I have seen other MEL errors cause errors at form load that interfere with something like this.
- Sandy White
Thanks for the suggestion. I had already given that a try -- dumping the contents of my function in a document variable and then using the document variable to populate the drop down. However, I received the same error.
For what it's worth after I posted the question I decided to do a test. Just a very simple function without any complicating logic. I did this:
fn fnDropTest()
{
local rtnString = "Abe, Bella, Christine, Derek, Elaine, Frank, George"
return rtnString
}
Then I put this in the box for the drop down after I checked 'Dynamic Choice List':
{fnDropTest()}
The list did not populate and I had the same error in the MEL trace I noted above.
The function declaration needs an ! character leading it so that will load into memory during in the initialization of the form. Once in memory, the function will be available to the form items when they are drawn.
! fn fnDropTest()
Hope this helps.
Thanks Lee. That helped. I also found that it would error when I called a function from a function library. I replicated the functionality from the library in the form itself and along with your suggestion it works as I intended.
I use a slightly different method...a comma delimited text file on a network share that can be edited by anyone with the proper rights to do so. This can help when someone else wants to add/remove an item in a drop down and doesn't have the FORM editing software.
I added this function to a usrlib...
//this function loads a drodown list from a text file on the network
{fn loadlist(fname){
local fhnd = FILEOPEN(fname, "r")
if fhnd <> NULL then
text = FILEREAD(fhnd)
FILECLOSE(fhnd)
endif
return text
}}
Then I call the function from within the dropdown by placing the following in as a MEL EXPRESSION
{loadlist("//YOUR SHARED NETWORK FOLDER HERE/Visual Forms Text Files/Provider_names.txt")}
Only thing to keep in mind is that the text file needs to be comma separated.
Also, if you want a BLANK option at the top of the list just place a comma before the first item in the list.
Hope this helps