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


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
PickList with more choices
Feb 25th, 2004 at 4:27pm
Print Post Print Post  
In following discussions --

http://www.lantica.com/Forum2/cgi-bin/yabb/YaBB.pl?board=archived;action=display...

http://www.lantica.com/Forum2/cgi-bin/yabb/YaBB.pl?board=gen_disc;action=display...

We could narrow the picklist using @userselectr function.  Entering "new.." in the field will present the list of the items which start with New.  This is all good. But sometimes, especially when the list is descriptive, we are not sure about the starting string, but we know we are looking for certain string (keywords).  In search for something like this, we use "..String.."  search criteria.  I believe this will give us more comprehensive and complete list. So instead of string.., I would also like to have choice of entering ..string.. for selecting appropriate picklist.  

Looking for Bronchi..,  the list will not have "Acute Bronchitis"  while ..Bronchi.. will present list with all kinds of Bronchitis such as, Chronic Brochitis, Acute Brochitis, Koch's Brochitis, Purulent Brochitis, like on and on.  

I will appreciate your ideas, input and broad outline as to how can we accomplish this?  I believe, we need to brainstorm (ofcourse lanticans probably come up with something like this in no time).  If I enter Harvard.. it will not present me Harvard University if it is listed as The Harvard University. I hope, you are getting my point and see the need for expanding horizon for picklist.
« Last Edit: Feb 25th, 2004 at 11:01pm by Bharat_Naik »  
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 choice
Reply #1 - Feb 25th, 2004 at 4:57pm
Print Post Print Post  
This code runs against Customers.
Code
Select All
// Finds all values in vVals that contain vMatch. Returns matching
// values as a semicolon separated list.
Function FilterValueList(var vVals as String, vMatch as String) as String
var vList as String
var vItem as String

	vList = ""
	While @Len(vVals) > 0
	{
		vItem = Split(vVals, ";")
		If @Instr(vItem, vMatch) > 0
		{
			If @Len(vList) > 0
			{
				vList = vList + ";"
			}
			vList = vList + vItem
		}
	}
	return(vList)
End Function


var vVals as String
var vFinalList as String
var vSearch as String

	vSearch = "op"	// Set the search string to whatever you want to match
	vFinalList = ""
	vVals = @XListValues(@FN, "Company")	// Get all the Company names
	vFinalList = FilterValueList(vVals, vSearch)
	WriteLn(@UserSelect(vFinalList))
 

  

- 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 choice
Reply #2 - Feb 25th, 2004 at 5:04pm
Print Post Print Post  
I never thought it would be this quick.  Smiley
I will try to incorporate this.  Thank You.. Thank You.. Thank You..
  
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 choice
Reply #3 - Feb 25th, 2004 at 11:00pm
Print Post Print Post  
Erika, thanks for the code. It works perfectly well. I would like to have the function placed in the Global Code, So it is available for other LEs. What varables I have to make Static Global variables for function to work properly from Global Code? Your guidance and help is very much appreciated. This is undoubtedly the best picklist code 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 #4 - Feb 25th, 2004 at 11:11pm
Print Post Print Post  
You shouldn't need any Global Statics. Just put the FilterValueList function in the GlobalCode area so any of the LE's can call it.
  

- 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 #5 - Feb 25th, 2004 at 11:16pm
Print Post Print Post  
I mean Static Variable, not global static. I will try and get back if I have any trouble.
  
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 #6 - Feb 25th, 2004 at 11:17pm
Print Post Print Post  
Quote:
I mean Static Variable, not global static. I will try and get back if I have any trouble.


So do I. Grin You still shouldn't need any.
  

- 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 #7 - Feb 25th, 2004 at 11:25pm
Print Post Print Post  
Erika,
As per your instruction, I placed the function part in Global Code and everything is working just fine. Thanks again.
  
Back to top
 
IP Logged
 
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: PickList with more choices
Reply #8 - Feb 25th, 2004 at 11:31pm
Print Post Print Post  
Anyone following this thread that is lost or a little confused should see the post Erika has entered in programming examples. It explains this a little better.

Thanks Erika, this is an excellent little snippet, it does indeed work nicely! Cheesy
  

Team – Together Everyone Achieves More
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 #9 - Feb 25th, 2004 at 11:39pm
Print Post Print Post  
You're quite welcome, gentlemen. I'm just surprised and gratified that two people in a row have managed to spell my name correctly! I think that's a record.  Wink Wink  Cheesy
  

- 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 #10 - Feb 25th, 2004 at 11:49pm
Print Post Print Post  
Bob Scott,
I have the previous code with @xuserselectr ( ) also in place. So practically one can use selection like, string.. or ..String..    This is the most commonly used retrival spec available to picklist.  This is just great.
  
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 #11 - Feb 27th, 2004 at 4:28pm
Print Post Print Post  
Erika, the custom filtering function seem to break the string when it counters "/" in the String (vItem). Unfortunately, I have to use a lot of "/"s.  Such as 150mg/5ml.  1/2 tsf, OrthoNovum 7/7/7, Tenoretic 25/12.5 mg. Any ideas to deal with this problem?  ???
  
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 #12 - Feb 27th, 2004 at 4:53pm
Print Post Print Post  
Bharat,

This character is always going to be a problem in a picklist. Under the hood, it indicates that you want to create a submenu. This can actually be quite powerful, but, if you don't want a submenu, you need to either filter slashes out of your data or double the slashes.

If you want 1/2 tsf to appear on a picklist, you need to make it 1//2 tsf.

  

- 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 #13 - Feb 27th, 2004 at 6:16pm
Print Post Print Post  
Quote:
Under the hood, it indicates that you want to create a submenu. This can actually be quite powerful, but, if you don't want a submenu,


With two slashes, it works fine. I would not have thought of anything like this in a million years. Smiley Thank. Can you please elaborate about a submenu? How would it work in this situation? What is its applicability?
  
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 #14 - Feb 27th, 2004 at 6:32pm
Print Post Print Post  
Quote:
With two slashes, it works fine. I would not have thought of anything like this in a million years. Smiley Thank. Can you please elaborate about a submenu? How would it work in this situation? What is its applicability?


We're working that out now. The automatic sorting behavior of the menu is interfering with creating custom submenus. We're looking for how to get around it.

The applicability is that you could present your user with categorized choices. Instead of a menu that looks like this:
Blue
Green
Large
Medium
Red
Small


...you could offer a menu like this:
Color >
       Blue
       Green
       Red
Size >
       Small
       Medium
       Large


... where the > indicates a popout submenu like you get on the Windows Start Menu.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send Topic Send Topic Print Print