Normal Topic On Form Entry vs On Element Entry (Read 788 times)
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
On Form Entry vs On Element Entry
Aug 1st, 2006 at 8:14pm
Print Post Print Post  
My Workorder database has 4 sections where a user must be able to select from combo boxes filled in by data from another database, Equipment.db.  I'm trying to figure out the best way to populate these combo boxes when the user opens the Workorder form.  The selections for each of the 4 combo boxes will be identical, and based on what the user selects other fields will be filled with data using @XLookup()

I've tested the following code in a practice database, EQLookups, and it works nicely:
Code
Select All
** PROGRAMMING SECTION: [Make0] [On Form Entry] **
Var vMake as String
Var vSort as string

//Populate the MAKE0 combo Box with a list of Makes

	vMake = @XListValues("equipmnt.db", "Equipment!Make")

	// Sort data alphabetically
	vSort = @SortStringArray(vMake, 0)

	//Remove leading blanks - Empty Records
	vSort = @Replace(vSort, ";;", "")
	If @Lt(vSort, 1) = ";" then
	{
		vSort = @replfir(vSort, ";", "")
	}
	// Remove duplicate entries, if any
	vSort = @UniqueStringArray(vSort)

	//Make the Combo Box List
	PopulateListElement(Make0, vSort) 



As you can see, I'm using On Form Entry (code derived from Inside Sesame).  However, not all 4 sections will always be used, so I am hesitant to populate all the combo boxes using on form entry, figuring that memory doesn't need to be occupied if not necessary.

Will On Element Entry work as well?  Or would it be slower?  My main objective is speed of the application; I don't mind writing/re-writing as much code as is necessary.

Thanks in advance for any help.
  

**
Captain Infinity
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: On Form Entry vs On Element Entry
Reply #1 - Aug 1st, 2006 at 8:39pm
Print Post Print Post  
On Element Entry will work as well to populate the combo box. But the code will run each time the user enters that element. So in the long run I believe it would be slower, if you moved it from the Form entry to the Element entry


-Ray
  

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


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Re: On Form Entry vs On Element Entry
Reply #2 - Aug 1st, 2006 at 8:43pm
Print Post Print Post  
Thanks Ray.  What I'm thinking I can do is, ON Form Entry, have the following at the bottom of the above referenced code:
Code
Select All
	//Make the Combo Box Lists
	PopulateListElement(Make0, vSort)
	PopulateListElement(Make1, vSort)
	PopulateListElement(Make2, vSort)
	PopulateListElement(Make3, vSort) 



And thereby populate all 4 combo boxes using the XListValues at the same time.  Would this work?
  

**
Captain Infinity
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: On Form Entry vs On Element Entry
Reply #3 - Aug 1st, 2006 at 8:47pm
Print Post Print Post  
If they all need to be populated with the same list then, Yes that will work. And it will be faster than duplicating that same chunk of code 4 times.

-Ray
  

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


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Re: On Form Entry vs On Element Entry
Reply #4 - Aug 1st, 2006 at 8:48pm
Print Post Print Post  
Super, thanks!
  

**
Captain Infinity
Back to top
IP Logged