Normal Topic @popupchoicelist  help (Read 499 times)
tcgeo
Full Member
***
Offline



Posts: 278
Location: Traverse City, Michigan
Joined: May 13th, 2008
@popupchoicelist  help
Jun 27th, 2008 at 3:53pm
Print Post Print Post  
I’m using the code below to create a @popupchoicelist that shows two fields represented by vCode and vDef, from a data base. It works great. However, I don’t want the entire selection placed in the form element “Group” when selected. It should only get the data in vCode. What I’ve done is to “cheat, if you will”, by creating “Group = @Left(vChoice,4)”, which grabs the first 4 letters of the combined @XResultSetValues vCode and vDef and places it in the form element “Group”. This method works ok for now but if vCode is longer than 4 letters the element will only receive the first 4 letters.

For example vCode = A, vDef = Head of Household. The user sees;
“A   Head of Household” in the Popup Choice List. When they select this only an A is placed in the form element.

So what I’m trying to do is to find a way that all of the info contained only in  vCode goes to the element “Group” no matter the size.

Sorry if I've missed this somewhere in the Programming Guide and samples. Can anyone point me in the right direction?

Thanks.

vList = ""
                 For vLoop = 1 To vCount
                       XResultSetCurrentPosition(vRS, vLoop)
                       vDef = @XResultSetValue(vRS, "Definition")
                       XResultSetCurrentPosition(vRS, vLoop)
                       vCode = @XResultSetValue(vRS, "Code")
                                               
                       vList = vList + vCode + "  " + vDef + ";"
                 Next
                       PopupSelectPosition(3, 200, 100)            
                       vChoice = @PopupChoiceList(vList, "SELECT A DEFINITION")
                       Group = @Left(vChoice,4)   
  
Back to top
IP Logged
 
CapitalG
Full Member
Members
***
Offline



Posts: 143
Location: Phoenix, Arizona
Joined: Mar 4th, 2003
Re: @popupchoicelist  help
Reply #1 - Jun 27th, 2008 at 7:52pm
Print Post Print Post  
If I understand your question, try this:

Code
Select All
vList = ""
                 For vLoop = 1 To vCount
   			XResultSetCurrentPosition(vRS, vLoop)
                       	vDef = @XResultSetValue(vRS, "Definition")
                      	vCode = @XResultSetValue(vRS, "Code")
                                                
                       	vList = vList + vCode + " - " + vDef + ";"
                 Next
                       PopupSelectPosition(3, 200, 100)            
                       vChoice = @PopupChoiceList(vList, "SELECT A DEFINITION")
                       Group = @Left(vChoice, @Instr(vChoice, "-")-1)    

  
Back to top
 
IP Logged
 
tcgeo
Full Member
***
Offline



Posts: 278
Location: Traverse City, Michigan
Joined: May 13th, 2008
Re: @popupchoicelist  help
Reply #2 - Jun 27th, 2008 at 8:19pm
Print Post Print Post  
Thank you CapitalG, that works like a champ. I never would have considered trying @Instr.

Now I’ve gotta go study to find out what it does.

Thanks again & have a great weekend!
  
Back to top
IP Logged