Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Multiply field by parameter Post Reply Post New Topic
Author Message
GrisCorp
Groupie
Groupie
Avatar

Joined: 08 Mar 2013
Online Status: Offline
Posts: 64
Quote GrisCorp Replybullet Topic: Multiply field by parameter
     Posted: 28 Mar 2014 at 10:36am
I am using CR XI R2.

I have four parameters necessary to run the report:
Formula,
Container (ie., box, bag, pail, etc),
Date (to run production),
Weight (to be produced)

In addition to the data entered in the parameters, I have the following database fields on the report:
Component (ingredients of part number selected in Formula parameter) ,
QtyPerLb
(of each Component listed in Details section.

I am designing a report in which I need to multiply QtyPerLb by the number entered in the Weight parameter in order to get a total weight per component.  When I try to write a formula to accomplish this, I get an error:
"A number or currency amount is required here."

and it highlights the Weight parameter:
{Structure.QtyPerLb} * {?Weight}

How can I write the formula correctly to accomplish my calculations?
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 28 Mar 2014 at 11:35am
The first question is: What is the data type of {Structure.QtyPerLb} and {?Weight}?  I am assuming that one or both are not an data type of number.
IP IP Logged
GrisCorp
Groupie
Groupie
Avatar

Joined: 08 Mar 2013
Online Status: Offline
Posts: 64
Quote GrisCorp Replybullet Posted: 31 Mar 2014 at 2:27am
{Structure.QtyPerLb} is a Number field and {?Weight} is an integer entered by the user.
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 31 Mar 2014 at 4:30am
I am at a loss at why it is giving you an error message.  I did a test using a number field from a data base and I created a number parameter (remember it defaults as a string), then created a formula.  Dropped everything on to the report and it worked fine.
IP IP Logged
GrisCorp
Groupie
Groupie
Avatar

Joined: 08 Mar 2013
Online Status: Offline
Posts: 64
Quote GrisCorp Replybullet Posted: 31 Mar 2014 at 5:09am
kevlray,

Your comment about it defaulting to a string made me check the parameter.  I changed the Type from 'String' to 'Number' then checked the formula for errors.  It successfully returned the "No Errors Found." message!

Thank you for your assistance!  Now I just have to figure out if CR can generate lot numbers for me.  I'll post in a new Topic for that.
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum