Normal Topic help with PopulateListElement (Read 745 times)
drastixnz
Full Member
***
Offline


A Newbie....

Posts: 146
Location: New Zealand
Joined: Nov 29th, 2006
help with PopulateListElement
Jun 10th, 2007 at 8:41am
Print Post Print Post  
Sad I am trying to pull data from a form that I have currently in the database, and populate a drop down that I have in another form so far I have only found the code to do it with a txt file, but I I have tryed

PopulateListElement(Merchant,@xuserselect("Estimator\Estimator.dsr", "Merchant_Info!Merchant"))

It does not give any error, but it seems to not work

Newbie alert here please help Thanks in advance,

Paul Dracevich
  
Back to top
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: help with PopulateListElement
Reply #1 - Jun 10th, 2007 at 9:01pm
Print Post Print Post  
1.  Should be looking in a database file, not a designer file.
PopulateListElement(Merchant,@xuserselect("Estimator\Estimator.db", "Merchant_Info!Merchant")).  Really want to use xuserselect?

2.  Is the path correct for the lookup file?  Suggest using full path:
PopulateListElement(Merchant,@xuserselect("C:\Sesame\Data\Estimator\Estimator.db", "Merchant_Info!Merchant")). 

3.  Reminder, XLUs do not work in Designer Mode, will only work in Database Manager.
« Last Edit: Jun 11th, 2007 at 3:21pm by Bob_Hansen »  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: help with PopulateListElement
Reply #2 - Jun 10th, 2007 at 9:05pm
Print Post Print Post  
@XUserSelect is not the right command for this. Try @XLookupAll or @XListValues.

Also, you want to do this from the form with the combo box you want to populate. You can't push the values into a combo box on a different form.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: help with PopulateListElement
Reply #3 - Jun 10th, 2007 at 9:34pm
Print Post Print Post  
[Edit: While composing this message, I had guests arrive, so that delayed my post. I see that Bob and Erika already posted by the time I did, but I will leave my post here in case it can help add to theirs.]

First of all, you probably don't want to use @XUserSelect within PopulateListElement, because that will only return one choice to fill the list with. You usually would use @XUserSelect to present the user with a list of choices from which you pick one to fill a regular element. But it sounds like you are using a Combo Box type of element, for which you want to give a list of choices that come from all the current entries that already are present in the Merchant field.

Second, you should be using ".db" rather than ".dsr" after the filename. If it is the same application file as the one you are working in, you could use @Filename (without quotes) instead of manually typing the path and filename.

Third, when referencing a filename, it needs to be with respect to the "Start In" (or "Current Working Directory"); which most often is "C:\Sesame". For example, if your application files are in "C:\Sesame\Data", and your Start In folder is "C:\Sesame", then you would use "Data\Estimator.db" as the filename. (If you are using a shortcut to start Sesame, you can check its properties for the Start In folder.)


Now, assuming you are using a Combo Box element, you might use something like the following:

PopulateListElement(Merchant, @XLookupAll("Data\Estimator.db", "/=", "Merchant_Info!Merchant", "Merchant"))

Notice that I am using @XLookupAll rather than @XUserSelect. Finally, if your Estimator.db file is actually in a folder named Estimator, then you may need to replace "Data\Estimator.db" with "Estimator\Estimator.db", or possibly "Data\Estimator\Estimator.db".
  


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


A Newbie....

Posts: 146
Location: New Zealand
Joined: Nov 29th, 2006
Re: help with PopulateListElement
Reply #4 - Jun 10th, 2007 at 9:42pm
Print Post Print Post  
Grin Thank you so much! (Spot Newbie Mistake)
  
Back to top
IP Logged