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

Array....I think

Status
Not open for further replies.

reportdr

Technical User
Apr 11, 2006
10
Hi

I am using Crystal 8.5 on a Windows XP/SP3 computer accessing an ODBC database.

I have a report where I'm splitting a year's worth of data into quarters. For instance, cases 1 formula indicates:

If DatePart ("m",{ABSTRACT.DISDATE} ) in [4,5,6] then +1 else 0

However, sometimes this report is run by calendar year and sometimes by fiscal year so the above wouldn't be appropriate in the first position of run by calendar year. I think I want an array here but I don't use them and need help.

Thanks very much.

S.
 
There's no such thing as an ODBC database, ODBC means Open Database Connectivity, which is an old standard for accessing various databases, you should also include the database as you may be able to use advanced functionality of the database to differentiate these things.

So how do you know when it is calendar vs. fiscal, are you using a parameter, or?

Perhaps something like:

(
If {?MyParm} = "Fiscal" then
(
if month({ABSTRACT.DISDATE}) in [4,5,6] then
1
else
if month({ABSTRACT.DISDATE}) in [7,8,9] then
2
else
...you get the idea...
)
else
(
If {?MyParm} = "Calendar" then
(
if month({ABSTRACT.DISDATE}) in [1,2,3] then
1
else
if month({ABSTRACT.DISDATE}) in [4,5,6] then
2
else
...you get the idea...
)
)

Looks about right.

-k
 
I'd assume you have a parameter to choose fiscal year or calendar year. Choose between the two methods and set your quarter option accordingly.

Datepart includes a quarter option, even in 8.5. I think it also allowed you to specify first day of week and first week of year, as extra parameters.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Hi

Thanks for the suggestions.

The database is hospital abstracting software programmed in C++.

Is there any way to minimize the creation of formulas using arrays/variables? For instance, right now I create 4 formulas for # of cases, 4 for number of days, etc.

As per Madawc's suggestion I would have a boolean parameter to determine calendar versus fiscal so cases 1 would be:

If {?Fiscal} and DatePart ("m",{ABSTRACT.DISDATE} ) in [1,2,3] then 1 else
If {?Calendar} and DatePart ("m",{ABSTRACT.DISDATE} ) in [7,8,9] then 1 else 0

Is there a way to only create an array so that the formulas would simply be {Cases}[1], {Cases}[2] etc?

S.
 
The Split command creates arrays in Crystal, but I don't think that's what you want. Crystal is a reporting tool, remember, not a full language. If you want to separate the quarters or get totals for them, insert a group using the formula. You can then make summary totals: right-click on a field and choose Insert to get a choice of Running Total or Summary. Summary totals can be done at group level as well as for the whole report.

Also take a look at crosstabs: you find them under Insert and they do a lot of the work for you.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Hi

I am using Crystal Reports 10 Version.
while exporting the date in text format,I want fix the column width with respect to the data base length, i e equal to the database characters length.
So can any body help me how to do that one.

Thank you,
 
Picture008, I answered your other post.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top