Page Index Toggle Pages: 1 [2]  Send Topic Send Topic Print Print
Hot Topic (More than 10 Replies) PickList with more choices (Read 2860 times)
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: PickList with more choices
Reply #15 - Feb 27th, 2004 at 7:09pm
Print Post Print Post  
Thanks Erika.
  
Back to top
 
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: PickList with more choices
Reply #16 - Feb 27th, 2004 at 9:02pm
Print Post Print Post  
As indicated earlier, the items with "/" display fine in the list like it should be.  But now @UserSelect does not seem to like that forward shlash!  If I choose anything with forward slash from the displayed list, nothing gets selected. Poor "/", nobody seems to like it.  Smiley  I believe, I am running out of choices here and its getting extremely difficult to provide refuge to slashes in my data. I am ready to throw towel, unless somebody comes with some solution.  Grin  Grin

Erika, I am sorry to annoy you with this one but it seems I am almost there and yet so far.
  
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: PickList with more choices
Reply #17 - Feb 27th, 2004 at 9:10pm
Print Post Print Post  
I'm able to select values with the slashes from @UserSelect. Why don't you post your code and I'll see if I can spot the problem?
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: PickList with more choices
Reply #18 - Feb 27th, 2004 at 9:38pm
Print Post Print Post  
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.

« Last Edit: Feb 28th, 2004 at 1:19am by Bharat_Naik »  
Back to top
 
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: PickList with more choices
Reply #19 - Feb 28th, 2004 at 12:55am
Print Post Print Post  
Erika,

The culprit is detected and problem solved. The program is performing xlookup in the display1 field where we had to manupulate and add one more Slash. When it picks up the value from the list, it has only one slash, so the key will not match. I modified the code in the Global Code to put an extra "/" and then do the lookup. It works just fine. I was reluctant to trouble you with deciphering the code which could be really difficult when you are not aware of all the other applications with which the code is interacting.  I have corrected the code in the previous note and placed a note to indicate where and why the statement is added, so if somebody is following this code, he will get an idea.  Thank you very much for all the help and hints.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1 [2] 
Send Topic Send Topic Print Print