Page Index Toggle Pages: [1] 2  Send Topic Send Topic Print Print
Hot Topic (More than 10 Replies) Programming help (Read 2338 times)
javir73
Member
*
Offline


No personal text

Posts: 20
Joined: Jun 30th, 2004
Programming help
Jun 30th, 2004 at 1:09pm
Print Post Print Post  
Hello,  I am attempting to convert several databases from Q&A to Sesame and was on a roll until I could not figure out this programming test line.  I am not a programmer by any means and would greatly appreciate the help.

IF Hours="" AND Cap<>"" THEN Hours=Cap/@XLU("REPS",REPRESENTATIVE,"CODE","HRLY_RATE")-2;IF Cap="500.00" AND R_LName="GRAN" THEN Hours="10"AND Cap="498.00"

Thanks

  
Back to top
 
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: Programming help
Reply #1 - Jun 30th, 2004 at 1:34pm
Print Post Print Post  
Quote:
IF Hours="" AND Cap<>"" THEN Hours=Cap/@XLU("REPS",REPRESENTATIVE,"CODE","HRLY_RATE")-2;IF Cap="500.00" AND R_LName="GRAN" THEN Hours="10"AND Cap="498.00"


I think it does not like the division.  @xlookup gets the value in string that you have to convert into number in order to perform mathematical operation.

IF Hours="" AND Cap<>"" THEN
Hours=Cap/@tonumber(@XLU("REPS",REPRESENTATIVE,"CODE","HRLY_RATE"))-2;

IF Cap="500.00" AND R_LName="GRAN" THEN   Hours="10"AND Cap="498.00"

===========

I believe above should work. If above does not work, you might have to put application with full path information like "c:\sesame\data\rep.db" for the application name.

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



Posts: 2530
Joined: Nov 22nd, 2002
Re: Programming help
Reply #2 - Jun 30th, 2004 at 2:14pm
Print Post Print Post  
Quote:
IF Cap="500.00" AND R_LName="GRAN" THEN   Hours="10"AND Cap="498.00"


This should probably be:

IF(Cap="500.00" AND R_LName="GRAN")
{
     Hours="10"
     Cap="498.00"
}
  

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


No personal text

Posts: 20
Joined: Jun 30th, 2004
Re: Programming help
Reply #3 - Jun 30th, 2004 at 3:09pm
Print Post Print Post  
I tried the @tonumber{@xlu(....)}-2;  and the exact as you wrote it.  My way states unknown identifier.  The way you wrote it, the error states, "Error while parsing module "Cap (1):  Boolean expression expected.  Line 1, position 167: EOL (end-of-line).  It displays no carrot to show me what it means as it did before, under the @.

Thanks for the help!
  
Back to top
 
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: Programming help
Reply #4 - Jun 30th, 2004 at 5:06pm
Print Post Print Post  
Putting together with what Mark stated earlier, the code should be as under:



IF Hours = "" AND Cap <> "" THEN  
       Hours = Cap / @tonumber(@XLU("REPS",REPRESENTATIVE,"CODE","HRLY_RATE"))-2;

IF Cap="500.00" AND R_LName="GRAN" THEN    
         {
                    Hours = "10"
                    Cap = "498.00"
          }


The { } in your code might be a problem @tonumber{@XLU("REPS",REPRESENTATIVE,"CODE","HRLY_RATE")}, could be replaced with ( ). When the error states "Unknown Identifier" means that some character or name used which is either not allowed or does not coincide with the element name (may  be spelling mistake and inadvertent space).
  
Back to top
 
IP Logged
 
javir73
Member
*
Offline


No personal text

Posts: 20
Joined: Jun 30th, 2004
Re: Programming help
Reply #5 - Jun 30th, 2004 at 7:25pm
Print Post Print Post  
I apologize if I'm being stupid here, but I type it as you guys have written it and it wants the "}" at the end removed.  I remove that, then it's looking for an end-of-line.  I attempted ";" but it didn't like that either.  I've checked and have had the spelling checked, so now I'm just lost again.
  
Back to top
 
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: Programming help
Reply #6 - Jun 30th, 2004 at 9:26pm
Print Post Print Post  
Cut/Paste is always better than "saying" what you have done.......

Perhaps you should Cut/Paste your current program up here again for another review with "outside" eyes.....
  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
javir73
Member
*
Offline


No personal text

Posts: 20
Joined: Jun 30th, 2004
Re: Programming help
Reply #7 - Jul 1st, 2004 at 11:10am
Print Post Print Post  
OK Here it is...

IF Hours="" AND Cap<>"" THEN Hours=Cap/@tonumber(@XLU("REPS",REPRESENTATIVE,"CODE","HRLY_RATE"))-2;IF Cap="500.00" AND R_LName="GRAN" THEN Hours="10"AND Cap="498.00"

Any help is greatly appreciated.
  
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Programming help
Reply #8 - Jul 1st, 2004 at 11:33am
Print Post Print Post  
Javir73,

Where is REPS? Has it been translated yet? What is the filename of the application that contains the programming you are showing us, i.e. REPS.DB?
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
javir73
Member
*
Offline


No personal text

Posts: 20
Joined: Jun 30th, 2004
Re: Programming help
Reply #9 - Jul 1st, 2004 at 11:49am
Print Post Print Post  
Reps is in my Data folder.  Yes it has been translated.  This program is part of a database/application called cases.
  
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Programming help
Reply #10 - Jul 1st, 2004 at 12:05pm
Print Post Print Post  
Quote:
Reps is in my Data folder.  Yes it has been translated.  This program is part of a database/application called cases.


OK, assuming that your element names/data types are correct and I'm guessing properly at your particular paths, try this:

Code
Select All
IF ((Hours = "") AND (Cap <> ""))
{
Hours = Cap / @tonumber(@XLU("Data/REPS.db", REPRESENTATIVE, "CODE", "HRLY_RATE")) - 2
}
IF ((Cap="500.00") AND (R_LName="GRAN"))
{
Hours = "10"
Cap = "498.00"
}
 



Note: If the @XLU fails or returns a zero, this will throw a runtime error when you try to divide by zero. If Test Program gives you errors when you paste this in, please paste the errors here, so we can see exactly what is going on.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
javir73
Member
*
Offline


No personal text

Posts: 20
Joined: Jun 30th, 2004
Re: Programming help
Reply #11 - Jul 1st, 2004 at 1:19pm
Print Post Print Post  
Thank you very much!  That worked.  I'm not sure how because there are IF's but no THEN's, but thank you.
  
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Programming help
Reply #12 - Jul 1st, 2004 at 1:22pm
Print Post Print Post  
Quote:
Thank you very much!  That worked.  I'm not sure how because there are IF's but no THEN's, but thank you.


You're welcome. We're glad to help.  Smiley

In SBasic (Sesame's programming language) the THEN is optional. I personally prefer using curly braces.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: Programming help
Reply #13 - Jul 1st, 2004 at 8:31pm
Print Post Print Post  
Another difference in the coding is the elimination of the semicolon from Q&A.

I have run into instances where Q&A translated, multiple commands, separated with semicolons, did not want to work.  When broken out onto separate lines Sesame got happy and did its thing.
  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Programming help
Reply #14 - Jul 1st, 2004 at 8:58pm
Print Post Print Post  
Quote:
Another difference in the coding is the elimination of the semicolon from Q&A.

I have run into instances where Q&A translated, multiple commands, separated with semicolons, did not want to work.  When broken out onto separate lines Sesame got happy and did its thing.


Do you have an instance of this that we could test in one of the sample databases? In Q&A does:

if(one = 22) then a = b; c = d; e = f

run the entire line, or only the first statement (a = b) as part of the conditional? I other words, if one equals 19 will c get set to d?
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send Topic Send Topic Print Print