Hot Topic (More than 10 Replies) xlookup from all ways (Read 1302 times)
debmckee
Full Member
***
Offline



Posts: 123
Joined: Oct 5th, 2011
xlookup from all ways
Oct 21st, 2011 at 4:48pm
Print Post Print Post  
This is my latest code.  No matter how I change this around I can't get it to work.  Have been trying for two days now!  Am relatively new at this so need all the help i can get!
application is:  Pacific coast fruit Products
element in source file where I am entering the lookup key is vendor0
external match  is located in form contacts!id#
I want to return name_address to vendor0 when the id# matches

I get a correct syntax when I check code but nothing happens.
  
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 from all ways
Reply #1 - Oct 21st, 2011 at 5:22pm
Print Post Print Post  
Hello,

Can you paste the code here so that I can take a look at it and perhaps see the problem?
Does your application have security on it?

-Ray
  

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



Posts: 123
Joined: Oct 5th, 2011
Re: xlookup from all ways
Reply #2 - Oct 21st, 2011 at 5:25pm
Print Post Print Post  
if @mode()=0 then


xlookup("data\pacific coast fruit products.db","vendor0",("contacts!ID#"),
     "name_address0",vendor0)                                             

There is no security on it.

PS:  Thanks!
  
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 from all ways
Reply #3 - Oct 21st, 2011 at 5:36pm
Print Post Print Post  
Hello,

Try the following code and let me know if it works for you.

Code
Select All
If @Mode()=0 Then
{
	XLookup("data\pacific coast fruit products.db", vendor0, "contacts!ID#", "name_address0",vendor0)
} 



-Ray
  

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



Posts: 123
Joined: Oct 5th, 2011
Re: xlookup from all ways
Reply #4 - Oct 21st, 2011 at 6:13pm
Print Post Print Post  
Still doesn't work
  
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 from all ways
Reply #5 - Oct 21st, 2011 at 6:25pm
Print Post Print Post  
I would like for you to run the following code and let me know the results. Place this in the same event as your current code.

Code
Select All
	If FileExists("data\pacific coast fruit products.db") Then
	{
		Writeln("Path to file is correct")
	}
	Else
	{
		Writeln("Path to file is incorrect")
	}
	If @Len(@XListValues("data\pacific coast fruit products.db", "contacts!ID#")) > 0 Then
	{
		Writeln("Form Name and External Key correctly spelled")
	}
	Else
	{
		Writeln("Form Name or External Key spelled incorrectly, or DB file is locked")
	}
	If @Len(@XListValues("data\pacific coast fruit products.db", "contacts!name_address0")) > 0 Then
	{
		Writeln("Form Name and Source correctly spelled")
	}
	Else
	{
		Writeln("Form Name or source spelled incorrectly, or DB file is locked")
	}
 



-Ray
  

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



Posts: 123
Joined: Oct 5th, 2011
Re: xlookup from all ways
Reply #6 - Oct 21st, 2011 at 6:46pm
Print Post Print Post  
I get the following message.

Path to file is correct
Form Name and External Key correctly spelled
Form Name and Source correctly spelled
  
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 from all ways
Reply #7 - Oct 21st, 2011 at 7:19pm
Print Post Print Post  
Hello debmckee,

Okay that all looks good. Go ahead and take that code out and try the following code.

Code
Select All
Var vReturn as String

	If @Len(@XLookupAll("data\pacific coast fruit products.db", "..", "contacts!ID#", "name_address0")) > 0 Then
	{
		Writeln("XLookupAll Worked")
	}
	Else
	{
		Writeln("XLookupAll Failed")
	}

	vReturn = @XLookup("data\pacific coast fruit products.db", vendor0, "contacts!ID#", "name_address0")
	Writeln("Vendor ID: " + @Str(vendor0))
	Writeln("Name and Address: " + vReturn)
	vendor0 = vReturn


	vReturn = @XLookup("data\pacific coast fruit products.db", @Int(vendor0), "contacts!ID#", "name_address0")
	Writeln("Second Return: " + vReturn)
 



-Ray
  

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



Posts: 123
Joined: Oct 5th, 2011
Re: xlookup from all ways
Reply #8 - Oct 21st, 2011 at 7:29pm
Print Post Print Post  
msg received is:

XLookupAll Worked
Vendor ID: zeljon
Name and Address:
Second Return:
  
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 from all ways
Reply #9 - Oct 21st, 2011 at 7:52pm
Print Post Print Post  
Hello,

Are you 100% positive that there is a record in 'pacific coast fruit products.db' that has just the value zeljon in the ID# element? Nothing more and nothing less, just zeljon.

-Ray
  

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



Posts: 123
Joined: Oct 5th, 2011
Re: xlookup from all ways
Reply #10 - Oct 21st, 2011 at 8:06pm
Print Post Print Post  
yes, when I preview in "preview mode"  And when I gointo the the program "live" and check it out I use a value I know exists there.  Incidentally, why is the data not in the preview mode in design?  It makes it difficult to check some code out.
  
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 from all ways
Reply #11 - Oct 21st, 2011 at 8:16pm
Print Post Print Post  
debmckee wrote on Oct 21st, 2011 at 8:06pm:
yes, when I preview in "preview mode"  And when I gointo the the program "live" and check it out I use a value I know exists there.


Can you send to support@lantica.com both 'pacific coast fruit products.db' and 'pacific coast fruit products.dat' so that I can have a look at them and see what is going on and why the value is not being returned.

debmckee wrote on Oct 21st, 2011 at 8:06pm:
Incidentally, why is the data not in the preview mode in design?  It makes it difficult to check some code out.


The DB and DSR files are completely separate sets of files that are only tied together during a reconcile. So they will have different sets of records in them. This allows a designer to work on design changes throughout the day and not disrupt users who are entering and editing data. The DSR files will have a copy of the records that existed in the DB file at the time of the DSR's creation from that DB file.

To get a current set of your records into DSR file follow these steps.
1: Be sure that your DB file has recently been reconciled. If it has not you will lose any unreconciled changes.
2: Open Sesame Designer
3: Click File->Open Application
4: Choose your .db
5: Click Yes to the message box saying the file already exists. Overwrite?

-Ray
  

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