Have not used VFE in a while and need help with the function to have a drop down list pull from a list contained on an external text document or a document contained in the document section of CPS.
can somebody help with this?
Thank you.
Here is one of mine. Contents of file is something like this: "doc_first_name\, doc_last_name, next_doc_first\, next_doc_last, ...etc"
Code in VFE:
{global doc_list}
{DOCUMENT.DOC_LIST}
{!
if doc_list <> "T" then
local fhnd
fhnd = FILEOPEN("\\\\server_name\\share_folder\\external_doc_list.txt", "r")
if fhnd <> NULL then
DOCUMENT.DOC_LIST = FILEREAD(fhnd)
endif
FILECLOSE(fhnd)
doc_list = "T"
else "" endif
}
Where DOCUMENT.DOC_LIST is the dynamic document variable for the drop down. I have it set to run every time the encounter is opened (because the list changes fairly often). You could change this to run once when the document is opened by not using the global variable and just checking if DOCUMENT.DOC_LIST has something in it.
Glad to help you. I can set up a WebEx to step you through the process. Contact me directly.
Thank you mike.
is there is any way to have it pull from a document held inside CPS text component section??
Are you wanting to have the Text Component run the code listed above or are you wanting the text that is contained in the Text Component be parsed into a dynamic drop down?
The latter would most likely require a SQL query or custom mldef function created to get to that data. Which can be done, it just isn't an ideal place to keep this information.
text be parsed in the drop down list, the same way it was done on that function you specify earlier but instead of having it pull the list of value from an external files. Have it pull from values contained in a Text component.
You could just add my code to the text component and instead of pulling from a file (FILEOPEN) and reading it (FILEREAD), you assign the drop down items with DOCUMENT.DOC_LIST = "item 1, item 2, item 3."
You could insert the text component with this form with ADD_TEXT_COMP to populate the drop down. The drop down will need to have the checkbox "Make available to other forms" checked. It seems to be a more cumbersome method, though.