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

Displaying a revenue spread

Status
Not open for further replies.

johnuk1

MIS
Joined
Aug 18, 2004
Messages
13
Location
US
I am running crystal 9.

Assuming I have a revenue value and a number representing number of months i want to display the months values across the page.

for instance if my revenue is 10000 and the number of months is 5 i want to display 2000 5 times. I thought I would use a shared array field. Then have another formula put the values in the array then have a field for each month that reads the array and says ok I am january therefore I will get any value from array position 1. The next field will say I am february therefore I will get any value from array position 2 etc. Is there a better way of doing this. I was thinking I could add text boxes and have the formula work out the spread then populate the text objects but i cannot appear to do this. Also tried to programmatically set the formula of a field to be the value i want. Note i am doing this all within a report using crystal basic.

any suggestions?
 
Using Crystal syntax (I'm not sure how you would do this in Basic), I think you could do a series of formulas like the following:

//{@Jan 2004}:
if dateadd("m",{table.numberofmonths},{table.date}) >= date(2004,01,01) and
{table.date} <= date(2004,02,01)-1 then {table.amount}/{table.numberofmonths}

//{@Feb 2004}:
if dateadd("m",{table.numberofmonths},{table.date}) >= date(2004,02,01) and
{table.date} <= date(2004,03,01)-1 then {table.amount}/{table.numberofmonths}

...etc.

-LB
 
what is table referring to? the database table?
 
Yes, you have to replace "table" with your table name, and field names that I've made up, like "numberofmonths" with your exact field name.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top