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

Calling an output value (to use in a seperate formula)

Status
Not open for further replies.

AlphaThis

IS-IT--Management
Apr 20, 2010
5
US
Hello all!
i am using Crystal Reports 10.
We group our products by their item numbers, and output the Quantity Sold Per month in rows of years.

ItemNumber Year JAN FEB MARCH
50 2009 2,193 1,953 1,223 <--(quantity sold)
2010 1,042 1,566 1,223

These are the variables..
{file.QtySoldMonth1}
{file.QtySoldMonth2}....
{file.year}
{file.ItemNumber}

how do i use the values under the months (QntySoldMonth) to include them in any specific calculation? ide like to reference them, and i am looking for the syntax that will call that specific value. meaning use "2193" in my own specified formaula, how can i call that value?
Hope you can help. Thanks so much.
 
create a formula, add your field and the calculations you would like to do, and add the formula to the area of the report you need it to display in.
below is a very general example. if you provide more details you will often get a specific example.

\\{@Formula1}
{file.QtySoldMonth1}+{file.QtySoldMonth2}+{file.QtySoldMonth3}+{file.QtySoldMonth24}


 
Thank you so much for the response. Sorry i wasn't too clear but you are very close. I am doing exactly as you mentioned, however i want to use {file.QtySoldMonth1} for 2009 and {file.QtySoldMonth1} for 2010 in the same formula. I am not sure of the syntax for the formula that actually uses the {file.QtySoldMonth1} field for the specific year.
once i am able to retrieve specific {file.QtySoldMonth1} from between the years and be able to plug that particular {file.QtySoldMonth1} in a formula a world of opportunity will open for us.
For instance:
({file.QtySoldMonth1} (2010) - {file.QtySoldMonth1}(2009)) / ({file.QtySoldMonth1}(2009)) ---- for percent change... and other calculations.
thx again
 
The below doesn't seem quite right for what you are asking, but I think you could do it using separate formulas for each part :

//{@2010Mo1}
numbervar q10;
IF {file.year}=2010 then q10 := {file.QtySoldMonth1};
q10

//{@2009Mo1}
numbervar q09;
IF {file.year}=2009 then q09 := {file.QtySoldMonth1};
q09

//{@20102009Mo1}
{@2010Mo1}-{@2009Mo1}/{@2009Mo1}


you will have only 1 qtysoldmonth1 for each year, right?
I think you would need to do the calculations in the item # group footer.
 
I don't think you have to use variables--you can just create formulas like this:

//{@item502010mo1}:
if {file.itemnumber} = 50 and
{file.year} = 2010 then
{file.qtysoldmonth1}

You can variables, but it just adds another level of complexity.

-LB
 
fisheromacse thats exactly what i needed and it worked perfectly!!!!!!!!!!!!
lbass thank you very much for the addition and that will come in handy.


I very much appreciate the help and the concept will enable me to do so much more. You guys rock!!!!!!!!!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top