Normal Topic Question regarding @xlookup (Read 1291 times)
Amor
Full Member
Members
***
Offline


No personal text

Posts: 366
Location: Germany
Joined: Feb 7th, 2004
Question regarding @xlookup
Jun 29th, 2006 at 12:02pm
Print Post Print Post  
Hello!

My Applicationname : Stechuhr
2 Databases (Forms) :  CLOCK and  MENU

In Form MENU (Form Entry or Retrieve)  want to ask  if the unique RecordNo already exit  in Form CLOCK. But it does not work!

Can someone please assist?

Thanks...
Dr. Belhareth

hier is the Code in Form Entry
var VId as String
var VRecordNo as String
var Vvorhanden as Int

VId = @UserID

VRecordNo = @Replace(@Date, "/", "") + @UserID
vVorhanden = @XLU(@fn;vRecordNo;"CLOCK!RecordNo", "RecordNo")


writeln("RecordNo : " + vRecordNo + " Ergebnis: " + vVorhanden)


//  I get always  :    RecordNo : 20060629michel     Ergebnis: 0
//  Ergebnis: 0  --> does not exit !
  

Dr. med. Amor Belhareth&&Medizin Labor &&Germany
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: Question regarding @xlookup
Reply #1 - Jun 29th, 2006 at 1:29pm
Print Post Print Post  
Hello Dr. Belhareth ,

@XLookup() returns a string.
You are assigning the value that @XLookup() returns to vVorhanden which is declared as an Int
You will want to change vVorhanden to be a string.

Then if vVorhanden matches vRecordNo then the record already exists in Clock.

-Ray
  

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


No personal text

Posts: 366
Location: Germany
Joined: Feb 7th, 2004
Re: Question regarding @xlookup
Reply #2 - Jun 29th, 2006 at 10:15pm
Print Post Print Post  
Hello Ray!

thank you very much for the quick Replay.

I have modified the Code but it still not working!

Hier is the last Code:

var vTree as INT
var vId as String
var vRecordNo as String
var vVorhanden as String

vId = @UserID

vRecordNo = @Replace(@Date, "/", "") + @UserID
vVorhanden = @XLU(@FN;vRecordNo;"CLOCK!RecordNo", "RecordNo")
 writeln("RecordNo : " + vRecordNo + " Ergebnis: " + vVorhanden)

IF vVorhanden = 1 Then {
GlobalValue("Action",1)
GlobalValue("RecordNo", vRecordNo)
vTree = @SelectTreeItem("Stechuhr!Forms!Search/Update!Clock!Clock")
}

i get : RecordNo : 20060630Michel  Ergebnis:



  

Dr. med. Amor Belhareth&&Medizin Labor &&Germany
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: Question regarding @xlookup
Reply #3 - Jun 30th, 2006 at 1:37pm
Print Post Print Post  
Hello,

vVorhanden is never going to equal 1. If the XLookup is successful, and the record exists, then it will equal the value in vRecordNo

Try the following code. Be sure you reconcile before you test it and do not test it in preview mode as X commands do not work in preview mode. Let me know what the WriteLn() window says.

Code
Select All
var vTree as INT
var vId as String
var vRecordNo as String
var vVorhanden as String

	vId = @UserID

	vRecordNo = @Replace(@Date, "/", "") + @UserID
	vVorhanden = @XLU(@FN, vRecordNo, "CLOCK!RecordNo", "RecordNo")
	writeln(@Error)
	writeln("RecordNo : " + vRecordNo + " Ergebnis: " + vVorhanden)

	If vVorhanden = vRecordNo Then
	{
		//The record already exists in clock
	}
 



-Ray
  

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


No personal text

Posts: 366
Location: Germany
Joined: Feb 7th, 2004
Re: Question regarding @xlookup
Reply #4 - Jun 30th, 2006 at 7:50pm
Print Post Print Post  
Hello Ray-

hier is the message:

yes
RecordNo : 20060630Michel
Ergebnis:

  

Dr. med. Amor Belhareth&&Medizin Labor &&Germany
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: Question regarding @xlookup
Reply #5 - Jun 30th, 2006 at 8:16pm
Print Post Print Post  
Hello,

There is a problem in the @XLookup().

Things to check:
Is "CLOCK" the name of a form in this DB file?
Does the "CLOCK" form have an element on it that is named "RecordNo"?
Are you in Preview Mode? X commands will not work in Preview mode.

-Ray
  

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


No personal text

Posts: 366
Location: Germany
Joined: Feb 7th, 2004
Re: Question regarding @xlookup
Reply #6 - Jun 30th, 2006 at 8:38pm
Print Post Print Post  
Hello,
 
The Structur is:

Stechuhr
   Forms
     add Data
       Cust_menu
            Cust_menu    
       Clock
            CLOCK
      ..


"CLOCK" is a form in this DB "Stechuhr"
and  "CLOCK" form have an element named "RecordNo" (unique field)
a tested it after reconciliation . (Clock .DB)


  

Dr. med. Amor Belhareth&&Medizin Labor &&Germany
Back to top
 
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Question regarding @xlookup
Reply #7 - Jul 1st, 2006 at 3:37am
Print Post Print Post  
What is the type of the RecordNo LE?

When you look at your CLOCK form at some data, what does the RecordNo LE look like?

If at all possible, hardcode the key argument in your XLookup instead of building the key in code. Use a string that you absolutely know matches perfectly. At the very least, do a writeln on the code that calcs the key argument, and make sure that it is formatted exactly like the RecordNo LE for the intended record. Remember that the key argument is formatted like a search spec, and uses the same special search characters that a search spec uses. Try using your key value in the RecordNo LE in search spec for CLOCK and see what record it returns.
  

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


No personal text

Posts: 366
Location: Germany
Joined: Feb 7th, 2004
Re: Question regarding @xlookup
Reply #8 - Jul 10th, 2006 at 9:35pm
Print Post Print Post  
Hallo Ray and Mark,

My ERROR found and fixed!

I  changed the separator to semi-colon in  @XLU(@fn;vRecordNo;"CLOCK!RecordNo", "RecordNo") and it works fine!

thanks.


  

Dr. med. Amor Belhareth&&Medizin Labor &&Germany
Back to top
 
IP Logged