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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Take certain chars from a field and multiply by another field 1

Status
Not open for further replies.

genekr

Technical User
Jul 19, 2005
45
US
I have a field AO2A200PE. I want to take the 5th, 6th and 7th characters (200) and multiply by another field (7.20) and get a result (1440.00). Crystal 9, PSQL 9, W2003 Server. Any help is appreciated.

Gene
 
Hi,
Create a formula:
@Multiplied
Code:
( ToNumber(mid({stringfield},5,3)) * {NumberField})



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Thank you. I tried this:

( ToNumber(mid({IMITMFIL.ITEM_NO},5,3)) * {IMITMFIL.ITEM_WEIGHT})

And received error:


Error in compiling SQL Expression:
Query Engine Error:'42000:[Pervasive][ODBC Client Interface]
[LNA][Pervasive][ODBC Engine Interface]Syntax Error:
Select (ToNumber(mid){IMITMFIL.<<???>>ITEM_NO},5,3))
*{IMITMFIL.ITEM_WEIGHT})FROM "IMITMFIL" "IMITMFIL"

 
Hi,
It is not to be used as part of the selection criteria, just as a field on the report.



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Sounds like you used a SQL Expression, use a standard Cyrstal formula.

Although you might be able to use a SQL Expression, they syntax would be different and it appears that you're using Pervasive, which tends to complicate things when doing so.

Use Turk's or this:

val(mid({stringfield},5,3)) * {NumberField}

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top