Normal Topic Xlookup with a Sub Form (Read 1167 times)
Marie
Member
*
Offline


No personal text

Posts: 5
Joined: Aug 2nd, 2005
Xlookup with a Sub Form
Aug 25th, 2005 at 6:14am
Print Post Print Post  
My tree looks like this

Office
     Forms
           Add Data
                 Main
                 Employee
                 Staff
                 HR
                           HR

I am running look up From staff in to HR
I want an xlookup using the element employeeid from staff
Staff is a sub form of main
The element in HR form is Employeeid that I want to match
The element in HR I want to return is Department.
I want to return it to the userdept element on staff

I am using the xlookup from a sub form

I am confused what is the form to use in the xlookup the main form or the sub form or?

I am confused with xlookups in use with sub forms can you please give a clear example of the xlookup syntax with relation to sub forms.

This is one of the many I tried
Xlookup(@fn,employeeid,"HR!employeeid","department",userdept)


Thank You.
  
Back to top
 
IP Logged
 
proudpoppy
Full Member
Members
***
Offline


Do What ??

Posts: 420
Location: South Carolina
Joined: Apr 7th, 2004
Re: Xlookup with a Sub Form
Reply #1 - Aug 25th, 2005 at 1:41pm
Print Post Print Post  
I use this in the subform layout: On Element entry
Price Each = @xlookup("c:\Sesame\data\gha_inv.db",Part Number,("Mastinv!Item number"),"Price Each")
  
Back to top
 
IP Logged
 
Marie
Member
*
Offline


No personal text

Posts: 5
Joined: Aug 2nd, 2005
Re: Xlookup with a Sub Form
Reply #2 - Aug 25th, 2005 at 2:58pm
Print Post Print Post  
Thanks,

But what syntax did you use. what is the form what is the subform. I just need a simple method to retrieve data from one db to another in the same application.
  
Back to top
 
IP Logged
 
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: Xlookup with a Sub Form
Reply #3 - Aug 25th, 2005 at 3:33pm
Print Post Print Post  
Run this code from were you want to run your Xlookup:

Var vlayout as string

vlayout = @layout

Writeln("app is " + @application)
Writeln("db is " + @database)
Writeln("filename is " + @filename)
Writeln("layout is " + vlayout)


This will pop up a window and give you some specifics. I find this helps me often.
Smiley
  

Team – Together Everyone Achieves More
Back to top
 
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Xlookup with a Sub Form
Reply #4 - Aug 26th, 2005 at 4:13am
Print Post Print Post  
Your syntax appears to be correct. Carefully check the spelling of the form and element names - watch for spaces.

Make sure that you are NOT testing it in Preview Mode (the 'X' family of functions don't work in Preview Mode). Be sure to test it in Sesame runtime as opposed to SDesigner's preview.

EDIT: Also, make sure that you are referring to the element names - not the field names ('bound to' names), and not the element labels.
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
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: Xlookup with a Sub Form
Reply #5 - Aug 26th, 2005 at 1:26pm
Print Post Print Post  
Another thing to look out for is if you have security on your application, be sure that your X Username and X Password are set to a valid login for that application.

-Ray
  

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


Do What ??

Posts: 420
Location: South Carolina
Joined: Apr 7th, 2004
Re: Xlookup with a Sub Form
Reply #6 - Aug 26th, 2005 at 11:14pm
Print Post Print Post  
Marie,

I try to explain it better:
Price Each = @xlookup(@Fn",Part Number,("Mastinv!Item number"),"Price Each")

Price Each is the present element in the subform
Part Number is the key in the subform to match.
Mastinv is the mainform
Item Number is the key in the mainform to match
Price Each is the element brought back from the mainform.

I worked on a xlookup one time for several hours, only to remember it only works in runtime.

Also had the problem with the security that Ray mentioned.

Done the one Bob mentioned too, misspelled element names, or bad syntax.

Good Luck !! Smiley
  
Back to top
 
IP Logged