Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

second request

Status
Not open for further replies.

reinaldo

Programmer
Mar 29, 2001
31
0
0
US
I can get a calculated field on a form to convert currency to text, simply by working with the experts and then creating the calculated field. I have tried to do the same on a report using the same steps with no success. I get the message "expression invalid in a calculated field". Can I make a field on a report to convert currency to text?
PDOX10WIN
thanks all!
 
An invalid expression notice usually points to a syntax error. Cut and paste the code from the calculation and post it here so we can see it.

Mac
 
Wish I could tell you more "expression invalid in a calculated field" is what I get when I create a calculated field on a report where I want the currency as text. This works just fine on a form for me but I cannot do it on a report.

getcurrencyastext(Number([CHECKS.Amount]))

Does not work on my reports

THANKS
 
Reinaldo,

You've run into a common situation with Paradox reports. Namely, reports cannot contain (or refer to) code stored on a form. Each Paradox document (form, report, script, etc) has a local scope, which is a programming way of saying that code is only visible on the document it appears in. Put another way, your error message is telling you that the report has no idea that getCurrencyAsText() exists on your form.

As a result, you'll need to store the actual result of getCurrencyAsText() in your table in order to print it with a report. There are more elegant ways of handling this, but this is the easiest to implement for some people.

Depending on your experience with ObjectPAL, I'd suggest adding a field to your table that's large enough to hold the results you're getting and then reworking your existing code to update that field with the results of getCurrencyAsText().

Without knowing your Paradox version or current implementation, I can't be more specific; however, we can help if you post some code.

Hope this helps...

-- Lance
 
Why not make an sql script and base the form on the script, complete with this calculated field.

This is how I handle calculated fields in Paradox. I have simple forms and any calculated fields are entered into an .sql script, and then when the script tests out OK, I am finished. The records are input into the form and updated by the script. Steve Butterworth

 
Steve,

That's one way to do it. If you're working with remote tables (Sybase, InterBase, Oracle, whatever), you can create stored procedures, views, or whatever to recalculate and save your values.

Your trick also works with QBE queries, though those are somewhat less capable than SQL queries.

There can be performance considerations with that approach. After all, you're continually calculating the same values. By saving the values when updates are saved to the tables, you can print them without that extra processing.

As with most things, the "best" approach depends on the specific situation. "To-MAY-to, to-MAH-to" and all that. :)

-- Lance
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top