Normal Topic SBasic  programing (Read 2289 times)
dcostanzo
Junior Member
Members
**
Offline


No personal text

Posts: 58
Joined: Mar 13th, 2003
SBasic  programing
Dec 29th, 2003 at 8:42pm
Print Post Print Post  
Hello

I am in the process of migrating a former Q&A database.
I have read through both  Quick Start and Q&A Translatation Guides.

I am having some trouble getting down the SBasic programing. I am trying to add two things together. Below is my three elements. I keep getting Error String.
I looked on page 41 in pPrograming book under using operators in programing. I just can get this to test correctly. Can anyone offer any assistance. Or if some one could correct me on how this should look.

In *.dsr
In Program Layout -Program Editor

TOTAL T D = GATE RATE + " " + TRANS PRICE TON

So Far, really like what you can do with Sesame, but just trying to get programing correct. Next will be Reports.

Thanks,

Dave Costanzo
  
Back to top
 
IP Logged
 
Bill Halpern
Lanticans
*****
Offline



Posts: 9
Location: Penna
Joined: Nov 22nd, 2002
Re: SBasic  programing
Reply #1 - Dec 29th, 2003 at 9:19pm
Print Post Print Post  
Dave,

Are you trying to add 2 numbers together in a numeric field (10 + 20 = 30) or are you trying to add strings of text ("Today" + " " + "is Monday" = Today is Monday)?

I ask because of the + " " + in your programming.  This indicates text strings but your titles indicate numbers.  If it is numbers you are going for, make sure that all of the fields you are adding are numeric and that the resulting field is numeric.  If you are adding numerics, you cannot have the +" "+ in the formula. Otherwise, you can use the @ToNumber() function like this:

@ToNumber(Total T D) = @ToNumber(Gate Rate) + @ToNumber(Trans Price Ton)
  
Back to top
 
IP Logged
 
dcostanzo
Junior Member
Members
**
Offline


No personal text

Posts: 58
Joined: Mar 13th, 2003
Re: SBasic  programing
Reply #2 - Dec 30th, 2003 at 4:06pm
Print Post Print Post  
Bill,  Thank you for your response.
Yes, I am trying to add two numbers together
I tryied the code you suggested.  I am a novice programer, so I have a lot to learn here.  I just need to pointed in the right direction.  Thanks again for your assistance.  If it helps. These are money fields or elements when translated. Should I have converted them to text format?

** PROGRAMMING SECTION: [ GLOBAL CODE ] [] **

** PROGRAMMING SECTION: [TOTAL T D] [On Element Entry] **
@ToNumber(Total T D) = @ToNumber(Gate Rate) + @ToNumber(Trans Price Ton)

When I test the the programming: I get the follow errors at bottom

Error String
Error while parasing module "TOTAL T D" (0)" :    Line1
Statement or End-of-File expected.
Line 1, position 1:  [Identifier: @ ToNumber]
@ToNumber(LENID00043) = @ToNumber(LENID000042) + ToNumber(LEIND000040)
^


  
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: SBasic  programing
Reply #3 - Dec 30th, 2003 at 4:15pm
Print Post Print Post  
Quote:
** PROGRAMMING SECTION: [TOTAL T D] [On Element Entry] **
@ToNumber(Total T D) = @ToNumber(Gate Rate) + @ToNumber(Trans Price Ton)

When I test the the programming: I get the follow errors at bottom

Error String
Error while parasing module "TOTAL T D" (0)" :    Line1
Statement or End-of-File expected.
Line 1, position 1:  [Identifier: @ ToNumber]
@ToNumber(LENID00043) = @ToNumber(LENID000042) + ToNumber(LEIND000040)
^


You can't put the @ToNumber on the element being assigned. Try this:
Total T D = @ToNumber(Gate Rate) + @ToNumber(Trans Price Ton)

BTW, the reason the error message shows LENID... instead of your element names is because you have spaces in your element names. This is not a problem, but it is why you see munged names. If your element names did not have spaces, you would see the actual names.
  

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


No personal text

Posts: 58
Joined: Mar 13th, 2003
Re: SBasic  programing
Reply #4 - Dec 30th, 2003 at 4:36pm
Print Post Print Post  
Thank you Hammer!

I think I am making some progress.  Ok After  trying
Total T D = @ToNumber(Gate Rate) + @ToNumber(Trans Price Ton)

I get a String Error at bottom, but that's all.  What does the test show if it is correct? I will add a new record an see if the two add up. Also, understand now about the spaces in element names.

Thanks for holding my hand here.
  
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: SBasic  programing
Reply #5 - Dec 30th, 2003 at 4:44pm
Print Post Print Post  
I'm not sure what a "string error" is. Can you post the error here so I can see it?

If the test is correct, you will see nothing in the error window. You may see warnings telling you that a particular element name is not legal. These can be ignored if you do not use that element name in programming.
  

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


No personal text

Posts: 58
Joined: Mar 13th, 2003
Re: SBasic  programing- Got It!!!
Reply #6 - Dec 30th, 2003 at 5:00pm
Print Post Print Post  
SmileyOK I have it programed. 

Thank You Bill and Hammer for your support.

No Errors.  Tested.  Everyting is adding up.  Changed element names with no spaces. This is what I ended up with

Total_TD = @ToNumber(Gate_Rate) + @ToNumber(Trans_Price_Ton)

Regards,

Dave Costanzo
  
Back to top
 
IP Logged