Simple math - not possible with Object Pal???? 
Author Message
 Simple math - not possible with Object Pal????

Quote:

>Hi there!  I'm hoping I may be able to get some assistance with what
>seems to be a simple problem.  

>To make a long story short, I have a button on a form that processes
>data in a table. In addition to other things, I need a simple formula to
>be applied to 2 blocks of data and written to a third.

>I've got a the formula, but it won't work, and it's driving me crazy.
>I'm new to Paradox 7 and ObjectPal, so I may be missing something, but I
>can't find any indication as to where I'm going wrong.

>What I need to do is this: Divide the number in the third field by
>10000.  Add that number to the second field and add that number to 35430
>to obtain the result. I've used all kinds of approaches with variables,
>brackets and still no luck.  This doesn't seem like it's too much to
>ask.  What's wrong with this?

>The formula I want to use is this:
>        dtnum = 35430 + tc.(2) + (tc.(3) / 10000)

>tc is type tcursor.  I know it's acting on these fields - it'll pick
>data up and replicate it in the new column, but won't do any math on the
>stuff!

Are the fields numeric or strings?   If strings you'll have to cast them as
numeric using number or numval before you can do the calculation.

--
Marilyn Ainslie
Cheshire  UK
http://www.***.com/



Mon, 06 Sep 1999 03:00:00 GMT
 Simple math - not possible with Object Pal????

Hi there!  I'm hoping I may be able to get some assistance with what
seems to be a simple problem.  

To make a long story short, I have a button on a form that processes
data in a table. In addition to other things, I need a simple formula to
be applied to 2 blocks of data and written to a third.

I've got a the formula, but it won't work, and it's driving me crazy.
I'm new to Paradox 7 and ObjectPal, so I may be missing something, but I
can't find any indication as to where I'm going wrong.

What I need to do is this: Divide the number in the third field by
10000.  Add that number to the second field and add that number to 35430
to obtain the result. I've used all kinds of approaches with variables,
brackets and still no luck.  This doesn't seem like it's too much to
ask.  What's wrong with this?

The formula I want to use is this:
        dtnum = 35430 + tc.(2) + (tc.(3) / 10000)

tc is type tcursor.  I know it's acting on these fields - it'll pick
data up and replicate it in the new column, but won't do any math on the
stuff!

Any help would be much appreciated.

Matt



Mon, 06 Sep 1999 03:00:00 GMT
 Simple math - not possible with Object Pal????

Quote:

> Hi there!  I'm hoping I may be able to get some assistance with what
> seems to be a simple problem.

> To make a long story short, I have a button on a form that processes
> data in a table. In addition to other things, I need a simple formula to
> be applied to 2 blocks of data and written to a third.

> I've got a the formula, but it won't work, and it's driving me crazy.
> I'm new to Paradox 7 and ObjectPal, so I may be missing something, but I
> can't find any indication as to where I'm going wrong.

> What I need to do is this: Divide the number in the third field by
> 10000.  Add that number to the second field and add that number to 35430
> to obtain the result. I've used all kinds of approaches with variables,
> brackets and still no luck.  This doesn't seem like it's too much to
> ask.  What's wrong with this?

> The formula I want to use is this:
>         dtnum = 35430 + tc.(2) + (tc.(3) / 10000)

> tc is type tcursor.  I know it's acting on these fields - it'll pick
> data up and replicate it in the new column, but won't do any math on the
> stuff!

> Any help would be much appreciated.

> Matt


Use the field name instead of the field Position inside the brackets,
then loose the brackets.

HTH

Che



Tue, 07 Sep 1999 03:00:00 GMT
 Simple math - not possible with Object Pal????

Quote:

> Hi there!  I'm hoping I may be able to get some assistance with what
> seems to be a simple problem.

> To make a long story short, I have a button on a form that processes
> data in a table. In addition to other things, I need a simple formula to
> be applied to 2 blocks of data and written to a third.

> I've got a the formula, but it won't work, and it's driving me crazy.
> I'm new to Paradox 7 and ObjectPal, so I may be missing something, but I
> can't find any indication as to where I'm going wrong.

> What I need to do is this: Divide the number in the third field by
> 10000.  Add that number to the second field and add that number to 35430
> to obtain the result. I've used all kinds of approaches with variables,
> brackets and still no luck.  This doesn't seem like it's too much to
> ask.  What's wrong with this?

> The formula I want to use is this:
>         dtnum = 35430 + tc.(2) + (tc.(3) / 10000)

> tc is type tcursor.  I know it's acting on these fields - it'll pick
> data up and replicate it in the new column, but won't do any math on the
> stuff!

As far as I can see, there's nothing wrong with your equation- except
maybe the order. You didn't say what went wrong? Did you get an error of
did you just get a wrong answer?

A incompat. error could be caused by using a constant in the beginning.
Paradox, I beleive, starts evaluating from the left. This could be a
problem. Declare a constant of the same type your fields are and set its
value.

If your getting a wrong answer, how are you positioning the tcursor to
the right record in your table.

What are you doing with the answer. Paradox can easily handle this
equation in a caculucated field. You can put it in a form or a report
and never really need to use a tcursor.

Gene



Wed, 15 Sep 1999 03:00:00 GMT
 
 [ 4 post ] 

 Relevant Pages 

1. Can I Use PAL and Not Object PAL on Paradox for Win 5.0 I need 3.5

2. Paradox Pal to Paradox for Windows Object Pal

3. Object Pal/Object Pascal

4. SIMPLE MATH

5. Problems with simple math functions

6. Simple Math problem

7. Simple math in COMPUTE clause?

8. Simple math query results in scientific number?

9. Paradox and simple math

10. Possible Bug - Grant Object Permissions by User and Group Not Working

11. This should be simple - Object Not Registered Correctly?

12. Is it possible under PAL (Paradox 4.0)?


 
Powered by phpBB® Forum Software