Normal Topic Pop Up Menu with Key Fields? (Read 701 times)
obfusc88
Full Member
***
Offline


No personal text

Posts: 194
Joined: Dec 17th, 2005
Pop Up Menu with Key Fields?
Dec 29th, 2016 at 4:14pm
Print Post Print Post  
I need a filtering picklist for thousands of items, I need to make a smaller pick list, currently getting too many items. I think the secret will be to use a Key Field, but I cannot figure out how to make it work for me. Each item has a unique non-intelligent part number.



I would like to get a expanding droplist, something like this, allowing me to pick the part number in the last column:

This allows the same part to be chosen from multiple Key values                              
I created a complete list of all items by using @XLookupSourceListAll that shows a descending list by Category showing Item No and Description. 

Code
Select All
If @ISBLANK(Item) then {
		// Get the list of all the Category Types and Items
		// (The KEY field must be the first field in the results list)
		vValList = @XLookupSourceListAll(@FN, "..", "INVENTORY!Category", "Category;ItemNo;Description")

		// Replace the semicolons with slashes to create the submenus
		vValList = @Replace(vValList, ";", "/")

		// Replace the line breaks with semicolons so the
		// whole thing can be passed to @PopupMenu.
		vValList = @Replace(vValList, @NewLine(), ";")

		// Sort the semicolon separated list
		vValList = @SortStringArray(vValList, 0)

		// Show the list as a picklist
		// ElementName cannot be a variable
		PopupSelectPosition(4, @Xpos(cmdAddLineItem), @Ypos(cmdAddLineItem))
		vChoice = @PopupMenu(vValList, "Choose A Category, then an Inventory Item")  


           
This works OK but is too long.  Can this be modified to handle Key Field values, maybe need to run multiple times? How do I add the needed submenu "/"s? Or is there another, better way to make the list?.            


1.  So, I want a similar list but instead of filtered just by Category, I want multiple sorts by about three fields, including one or two Key Value fields.            

2.  Since this might take some processing time, how can this picklist be created as a Global Static value in GLOBAL code on the PickList Form so it only runs once?

3.  Can the Global Static value in a PickList Form be automatically updated by putting code in the Inventory form that updates when certain values are added/modified/deleted?

  
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Pop Up Menu with Key Fields?
Reply #1 - Jan 3rd, 2017 at 2:41pm
Print Post Print Post  
You are going to want to use the XResultSet Family of commands to generate your picklist. This will allow you to compare values as stepping through records and put in the appropriate submenu separators. This will also allow you to sort the resultset the way that you want.

Once the list is generated, you can store it in a GlobalValue() which will make it be stored with the Sesame Database from session to session and be able to be updated.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
obfusc88
Full Member
***
Offline


No personal text

Posts: 194
Joined: Dec 17th, 2005
Re: Pop Up Menu with Key Fields?
Reply #2 - Jan 3rd, 2017 at 3:04pm
Print Post Print Post  
Thanks for the suggestion Ray.  I will give that a try.
  
Back to top
 
IP Logged