Normal Topic Type-ahead support in a Picklist (Read 1131 times)
wildwood
Full Member
***
Offline


No personal text

Posts: 156
Location: New York
Joined: Apr 2nd, 2004
Type-ahead support in a Picklist
Dec 3rd, 2005 at 4:52pm
Print Post Print Post  
I have a camper application which includes a camper form for emergency information and a special programs form. After entering all info on a camper if a particular camper wishes to enroll in a special program I open the Special Program form, in add data, and a picklist of ALL campers opens. I then scroll down to the particular camper and hit enter and a form opens up with all his info. The programming I am using is:

if camper:="" then camper:=@XUS(@fn,"cw06!camper:")

It works just fine, however, I read in this month's Inside Sesame that in a combo box you can type ahead a long list and it automatically scrolls to the letter you've typed. Is it possible to do this in my picklist, @XUS ??

Peter
  
Back to top
 
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Type-ahead support in a Picklist
Reply #1 - Dec 3rd, 2005 at 5:00pm
Print Post Print Post  
No, not in an XUserSelect. But you can populate a ComboBox using the "X Commands" and use that instead. Look up PopulateListElement.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Type-ahead support in a Picklist
Reply #2 - Dec 3rd, 2005 at 11:52pm
Print Post Print Post  
Peter,

I would like to see all picklists in Sesame work the way you describe. But until that happens, here is an example of what Mark has suggested.

Code
Select All
var vList as String

vList = @XListValues(@Fn, "MyForm!MyComboBoxLE")
vList = @SortStringArray(vList, 0)	//0 = ASCII sort, 1 = Number sort
vList = @UniqueStringArray(vList)	//Removes duplicates
PopulateListElement(MyComboboxLE, vList)
 


MyComboboxLE is, of course, a ComboBox type of layout element. This means you would need to change "camper:" in your example, to a ComboBox.

Code
Select All
var vList as String

vList = @XListValues(@Fn, "cw06!!camper:")
vList = @SortStringArray(vList, 0)	//0 = ASCII sort, 1 = Number sort
vList = @UniqueStringArray(vList)	//Removes duplicates
PopulateListElement(camper:, vList) 


Optionally, you could also build a list of selections that fit a certain criteria that is in another LE, by replacing @XListValues with @XLookupAll. This way, your list would only contain a list of campers from records where the external key LE was the same as in the key LE in the current form. Like the following:

Code
Select All
vList = @XLookupAll(@Fn, MyKeyLE, "MyForm!MyKeyLE", "MyComboBoxLE") 


  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
wildwood
Full Member
***
Offline


No personal text

Posts: 156
Location: New York
Joined: Apr 2nd, 2004
Re: Type-ahead support in a Picklist
Reply #3 - Dec 5th, 2005 at 11:02pm
Print Post Print Post  
Carl,
I'll give it a go.

Thank you,
Peter
  
Back to top
 
IP Logged
 
Louis Galvao
Full Member
***
Offline


"Sufferin' Succatash"

Posts: 265
Location: Canada
Joined: Feb 14th, 2005
Re: Type-ahead support in a Picklist
Reply #4 - Dec 16th, 2005 at 10:39pm
Print Post Print Post  
Carl:

This works great !

Thanks for posting that code.

Louis Galvao
  

Louis Galvao
Back to top
 
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Type-ahead support in a Picklist
Reply #5 - Dec 16th, 2005 at 10:45pm
Print Post Print Post  
Louis,

Glad to hear that.

Your welcome.

Carl
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged