Normal Topic @XLookup problem - again (Read 1425 times)
NHUser
Full Member
***
Offline



Posts: 320
Location: Amherst, NH
Joined: Aug 2nd, 2010
@XLookup problem - again
Aug 6th, 2012 at 3:22pm
Print Post Print Post  
I Am using the following programming to get information from two elements in my Newprocs file. 

For some reason, the programming does not work when I try to set the DataFlag element.  I've checked the spelling and changed the name of the element in my Newprocs file (currently called "MARK"). 

Nothing I do seems to work.  Both the DataFlag and Mark are text elements.

I know the statement is correct because when I change "Mark" to some other element in Newprocs, it works! 

Any thoughts??

NHUser



// GO GET THE CUSTOMER NAME AND SET FLAG FROM THE WORK INSTRUCTION FILE

If @isBlank(DCNO)=0
{
     CUSTOMER = @XLU(@fn,DCNO,"NEWPROCS!DIACOM P\N","CUSTOMER")
     DataFlag = @XLU(@fn,DCNO,"Newprocs!DiaCom P\N","Mark")
}
writeln("->"+DataFlag+"<-")
« Last Edit: Aug 6th, 2012 at 7:58pm by The Cow »  
Back to top
 
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: @XLOOKUP PROBLEM - AGAIN
Reply #1 - Aug 6th, 2012 at 3:26pm
Print Post Print Post  
Backslash in the literal string may be the issue. Even if it isn't - never put a backslash in a literal string.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
NHUser
Full Member
***
Offline



Posts: 320
Location: Amherst, NH
Joined: Aug 2nd, 2010
Re: @XLOOKUP PROBLEM - AGAIN
Reply #2 - Aug 6th, 2012 at 3:32pm
Print Post Print Post  
That backslash is a holdover from the programming that Lantica did for me when we went from Q&A to Sesame.  I don't use the backslash when I program.

It seems to work fine in the first line and will work OK in the second line if I get info from an element different than "Mark".

What could be causing the "Mark" element not to work?
  
Back to top
 
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: @XLOOKUP PROBLEM - AGAIN
Reply #3 - Aug 6th, 2012 at 3:51pm
Print Post Print Post  
Did Lantica name something "DIACOM P\N" ?

Even if it works, change the name. Its fine to have that in a label. But a backslash in a quoted literal string is always a bad idea in programming. MS, against all reason, tradition, and advice, used backslashes in their file path (instead of the traditional and established use of the forward slash). Unfortunately for programmers everywhere, the backslash was already established as the "escape character" (a character indicating that the next character should be skipped). So, throughout all code that must run on MS OSs, there are tons of file paths in which all of the backslashes are doubled. They look like this:

Code
Select All
path = "C:\\Users\\MyName\\MyDirectory\\MyFile"
 



Drives us all crazy.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
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 PROBLEM - AGAIN
Reply #4 - Aug 6th, 2012 at 3:51pm
Print Post Print Post  
Hello Paul,

Check to make sure that the name is not 'Mark ', note the space after Mark. I've seen this happen a few times.

-Ray
  

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



Posts: 320
Location: Amherst, NH
Joined: Aug 2nd, 2010
Re: @XLOOKUP PROBLEM - AGAIN
Reply #5 - Aug 6th, 2012 at 4:31pm
Print Post Print Post  
Yes, Lantica created the element "DIACOM P\N" when I first bought Sesame.  Unfortunately, this is the key element for connecting all my databases together, so I can't change it at this time.  I will have to go through hundreds of lines of programming corrections if I do!

I tried putting a space after "Mark" (it became "Mark ") without success.
  
Back to top
 
IP Logged
 
NHUser
Full Member
***
Offline



Posts: 320
Location: Amherst, NH
Joined: Aug 2nd, 2010
Re: @XLOOKUP PROBLEM - AGAIN
Reply #6 - Aug 6th, 2012 at 5:40pm
Print Post Print Post  
I discovered what is wrong...

It has something to do with the forms and file structure.  When the database file was first created (by Lantica), the form was newprocs under a file of newprocs.  (I don't know if I'm using the proper terminology.  See the attached screen shot).

I updated the form offline while it was still in use by my coworkers, so i gave the "new" form the new name "work instructions".

I thought the file newprocs would contain all the data elements in all the forms it contained.  However, the command was looking in the form newprocs and not the form 'work instructions'.  It works fine when I changed the programming to:      

DataFlag = @XLU(@fn,DCNO,"Work Instructions!DiaCom P\N","Mark")

  

Sesame_06-Aug-12.jpg ( 23 KB | 35 Downloads )
Sesame_06-Aug-12.jpg
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 PROBLEM - AGAIN
Reply #7 - Aug 6th, 2012 at 6:41pm
Print Post Print Post  
Hello Paul,

The file you are referring to is actually the database. It contains all the fields that the elements on the forms NEWPROCS, WI OLD, and Work Instructions. XLookup and it's family of commands use the Form and Element names unlike the XResultSet family of commands that uses the Database and Field names.

-Ray
  

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