I am using different picklists for different elements. I have placed the Function that you provided in the Global Code.
var vFieldName as String (This variable to defined in Global Code earlier and first initialized in Dx1 element exit code) so are the vStart and vEnd variables.
Moreover the following also goes Global Code
==================== var vStart as String var vEnd as String var vFieldName as String var vApplication as String var vTarget as String var vDisplay as string
//For PickList
Subroutine PickList_choose( ) var vVals as String var vFinalList as String var vSearch as String
If @Right (vfieldName, 2) = ".." and @Left (vFieldName, 2) <> ".." then { vStart = @left (vFieldName, @in (vFieldName, "..") - 1) + @chr (1) vEnd = @left (vFieldName, @in (vFieldName, "..") - 1) + "zzzzzzz"
}
If @left (@(vFieldName), 2) = ".." and @Right (@(vFieldName), 2) = ".." then { vSearch = @replace (@(vFieldName), "..", "") vFinalList = "" vVals = @XListValues(vApplication, vDisplay) vFinalList = FilterValueList(vVals, vSearch) @(vFieldName) = @UserSelect(vFinalList) /* The following statement is added to add an extra "/" into the list value that was picked up by userselect in the preceding statement, so that it will match with the Display1 element value in the external application, where we had to add an extra "/" to correct the problem having "/" in the data. The following statement add that "/"
If @in (@(vFieldName), "/") > 0 then @(vFieldName) = @Replace (@(vFieldName), "/", "//") //writeln (@(vFieldName))
@(vFieldName) = @xlookup (vApplication, @(vFieldName), "Display1", vTarget)
}
End Subroutine
In the Element Exit of Dx1 (Diagnosis1) ===================
If @left (Dx1, 2) = ".." and @right (Dx1, 2) = ".." then
{ vApplication = "data\diag.db" vTarget = "DiagCode" vDisplay = "Diag!Display1" vFieldName = "Dx1" picklist_choose ( ) }
if @Right (Dx1, 2) = ".." and @Left (Dx1, 2) <> ".." then
{ vFieldName = Dx1 picklist_choose ( ) Dx1 = @xUserselectR ("data\Diag.db", "Diag!Display", "DiagCode", vStart, vEnd) }
I am using picklist in 14 Medications elements and 3 Diagnosis elements to begin with. [ The string.. code part works fine with "/" but not the ..string.. part. The items without slash in them work fine with both the codes.]
The above problem is corrected.
Display and Display1 are the two standard elements of Forms, where I prepare a Display and maupulate it accordingly like, remove any "," or ";" or any characters that I do not wish to have. Since it is standard, I do not have to create and assign any variable to these items.
Thanks.
|