Hot Topic (More than 10 Replies) xlu - newbie at programming (Read 1576 times)
jyellis
Full Member
Members
***
Offline


No personal text

Posts: 114
Location: Dallas-Fort Worth Area
Joined: May 19th, 2003
xlu - newbie at programming
Dec 16th, 2005 at 10:58pm
Print Post Print Post  
I want my Time To Reach element to look at the Vo2_Max Table and when it matches the LE3; put the Tbl_Vo2_Max value from there in the Vo2 Max element here.  I get nothing.

This is my only line of programming in the Time to Reach element; On event exit  (Test in the program editor results in no errors)

I have tried several scenarios  (V02_Max is in the same file as the form I am trying to put the values on)

Code
Select All
xlu("fitness assessment.db", Time to Reach , "Vo2_Max!LE3", Vo2 Max, vo2 Max)


and


xlu("fitness assessment.db", Time to Reach , "Vo2_Max!LE3", "Vo2 Max", vo2 Max)

and

xlu(@fn, Time to Reach , "Vo2_Max!LE3", Vo2 Max, vo2 Max)

 




Thanks for your help in advance
  
Back to top
 
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: xlu - newbie at programming
Reply #1 - Dec 17th, 2005 at 2:47am
Print Post Print Post  
From your example, it appears that you have a form named "Vo2_Max" and a LE named "Vo2 Max" on that form, as well as a LE named "Vo2 Max" on the current form. I recommend that you rename at least the form, so as to reduce the possibility of calling something "Vo2 Max" when you meant "Vo2_Max" or vice-versa.

You might try:
Code
Select All
var vTmp as string

  vTmp = @ xlu(@fn, Time to Reach , "Vo2_Max!LE3", "Vo2 Max")
  if(@Error)
  {
    WriteLn("XLookup produced an error.")
  }
  else
  {
    Vo2 Max = vTmp
  }
 



If Vo2 Max is a number (not a string), replace the line:
Code
Select All
Vo2 Max = vTmp
 



with:
Code
Select All
Vo2 Max = @ToNumber(vTmp)
 

  

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


No personal text

Posts: 114
Location: Dallas-Fort Worth Area
Joined: May 19th, 2003
Re: xlu - newbie at programming
Reply #2 - Dec 17th, 2005 at 3:32pm
Print Post Print Post  
First I took your suggestion to fix the names.

In this form I have:
Fields:
FETime
FEVO2Max

In the form where I want to retrieve the data:
Form Name
Tblvo2Max
Fields:
TblTime
TblFieldvo2Max

Code
Select All
var vTmp as string

 vTmp = @xlu(@fn, FETime, "TBLvo2Max!TblTime", "TblFieldVO2Max")
 if(@Error)
 {
    WriteLn("XLookup produced an error.")
  }
  else
  {
    FEVO2Max = @ToNumber(vTmp)
  }
  



I still get a lookup error.  Question:  The Tblvo2Max is in the same file (called Fitness Assessment.db) but on the tree it is under a different database.  The tree has Database and Database0.  I know why I just don't know how to move it.   I don't know how to paste that into this forum (I have "SNAGIT" it as a image)...if you don't understand.
  
Back to top
 
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: xlu - newbie at programming
Reply #3 - Dec 17th, 2005 at 7:36pm
Print Post Print Post  
Ah - this is one of those times when I really wish 2.0 was out already. It has command that can tell you more than @Error as to the actual nature of the error.

Are you absolutely sure that there is a matching value between FETime and TBLvo2Max!TblTime? If at all possible, try using two string LEs and (for test purposes), set both LEs to exactly the same string. It may be easiest to simply hardcode the key string right in the @XLookup:

Code
Select All
vTmp = @XLookup(@Fn, "Test Value", "MyForm!MyLe", "AnotherLE")
 



assuming in the case above that you have already put the string "Test Value" in the LE called MyLe in the form "MyForm". See what I mean?
  

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


No personal text

Posts: 114
Location: Dallas-Fort Worth Area
Joined: May 19th, 2003
Re: xlu - newbie at programming
Reply #4 - Dec 19th, 2005 at 1:51pm
Print Post Print Post  
It still fails.

I created two new string le's on two new forms (Destination; Source)  I entered string data in the source form (TBLTest: apple) and corresponding string data in Destination form (TBLResult: good)

The programming is on element change of feTest

Source form:
TblTest
TblResult

Destination form:
FeTEST
FeResult

Code
Select All
var vTmp as STRING

vTmp = @xlu(@fn, feTEST, "Source!TblTest", "TblRESULT")
   if(@Error)
{
 	  WriteLn("XLookup produced an error.")
}
	  else
  {
	feResult = vTmp
  }

 

  
Back to top
 
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: xlu - newbie at programming
Reply #5 - Dec 19th, 2005 at 3:09pm
Print Post Print Post  
I am not sure how the string "apple" corresponds with the string "good".

Are you in preview mode?

Try putting the string "test me" in Source!TblTest, and run the following (not in preview mode):
Code
Select All
var vTmp as STRING

  vTmp = @xlu(@fn, "test me", "Source!TblTest", "TblRESULT")
  if(@Error)
  {
    WriteLn("XLookup produced an error.")
  }
  else
  {
    feResult = vTmp
  }
 

  

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


No personal text

Posts: 114
Location: Dallas-Fort Worth Area
Joined: May 19th, 2003
Re: xlu - newbie at programming
Reply #6 - Dec 19th, 2005 at 4:28pm
Print Post Print Post  
1.  Not in preview mode.
2.  LE..Tbltest = Apple and LE...TblResult = Good
3.  Changed to hardcode "TestMe"

Still brings up error.

  
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2480
Joined: Aug 20th, 2003
Re: xlu - newbie at programming
Reply #7 - Dec 19th, 2005 at 9:10pm
Print Post Print Post  
Hello,

Well since it is the holiday season, send your DB and DAT files to support@Lantica.com and I will have a look at it for you.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2480
Joined: Aug 20th, 2003
Re: xlu - newbie at programming
Reply #8 - Dec 20th, 2005 at 3:17pm
Print Post Print Post  
Hello Judy,

You will should have an e-mail here shortly with your DSR and DDT files attached. In the e-mail is an explanation of what needed to be done in order for the @XLookup() to work.

Happy Holidays,
Ray
  

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


No personal text

Posts: 114
Location: Dallas-Fort Worth Area
Joined: May 19th, 2003
Re: xlu - newbie at programming
Reply #9 - Dec 20th, 2005 at 8:52pm
Print Post Print Post  
Thanks. IT WORKS GREAT. 

Now I have another question. 
[email]The second one was that the XLookup is being done on two time fields.
Internally in Sesame a time is formatted as 02:30:00 but the element you were using as your key value was formatted as 02:30. What I did instead of changing your formatting was I added {+ ".."}, minus the braces, to the key value in the XLookup [/email]
I have two more time fields I will need to create a similar lookup....except the xlookup may not find an exact match so the next lower corresponding value needs to be assigned.  I thought the XlookupR would do it.  But it pulls in the next highest value.
Table Form (Source)

Time   Rating
1:15    50
1:30    60
1:45    70

Rating Form (Destination)

Time  Rating
1:39    60    (correct answer...XluR pulls in 70)

  
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2480
Joined: Aug 20th, 2003
Re: xlu - newbie at programming
Reply #10 - Dec 20th, 2005 at 9:15pm
Print Post Print Post  
Hello Judy,

For XLookupR() instead of the {+ ".."}, without the braces, at the end of the key value use {+ ":00"}, without the braces.

-Ray
  

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


No personal text

Posts: 114
Location: Dallas-Fort Worth Area
Joined: May 19th, 2003
Re: xlu - newbie at programming
Reply #11 - Dec 20th, 2005 at 9:44pm
Print Post Print Post  
Grin 8) Roll Eyes
I am so Happy!!!! I've learned so much working through this problem with your help.  This forum is SO valuable.

Happy Holidays!!!

Aren't these people GREAT!!!!
  
Back to top
 
IP Logged