Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Prompt for formula value Post Reply Post New Topic
Author Message
rf2209
Newbie
Newbie


Joined: 15 Jul 2011
Online Status: Offline
Posts: 4
Quote rf2209 Replybullet Topic: Prompt for formula value
     Posted: 09 Nov 2011 at 5:27am
I am building a report that builds in a varying product price, for example fuel fluctuates up and down, when the user runs the report I want the formula to sum the expenditure for petrol and divide it by the price and then the same for diesel which has a different price.

Is it possible to prompt the user to do this?

Cheers

IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 09 Nov 2011 at 5:36am
do you mean you want the user to enter a price for diesel and a price for petrol?
just add 2 parameters (likely you will want to use currency data type) with any label/name you desire (e.g. "Petrol Price", "Diesel Price").
(You may want to put min and max values to help avoid entry errors).
you can then use these values in your report.
examples...
{table.field}/{?Petrol Price}
SUM({table.field})/{?Petrol Price}


Edited by DBlank - 09 Nov 2011 at 5:38am
IP IP Logged
rf2209
Newbie
Newbie


Joined: 15 Jul 2011
Online Status: Offline
Posts: 4
Quote rf2209 Replybullet Posted: 09 Nov 2011 at 5:50am
Yeah I do, I'll try and get it work that way, Im new to Crystal so a bit lost.

Thanks for your help
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 09 Nov 2011 at 6:00am
go into the field explorer
right click on Parameter fields
select New
 
name it (e.g. Diesel Price)
change the type to "currency"
skip down to options
add in a min and max if you want them
hit OK
repeat for "Petrol Price"
 
in the field explorer right click on Formula Field
select new
add a name (e.g. Petrol Divided)
add your formula here
example...sum({table.expenditure})/{?Petrol Price}


Edited by DBlank - 09 Nov 2011 at 6:17am
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