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

Group specified on a non-recurring field

Status
Not open for further replies.

Jen123

Technical User
Mar 9, 2001
64
GB
This problem is listed on the BO website and it basically say's that it's known problem in CR8 but is resolved on more recent versions.

I need a group which is based on a formula. I can't see the formula in the insert group pop up (any ideas?). If I try and force it, i.e set it to a formula that I can see and change the formula to what I want it to be I get an error message "Group specified on a non-recurring field".

The formula works a treat in details but I just can't group on it?

I'm using CR10

This is the formula info:

EvaluateAfter({@Period to Date});

Local StringVar TermDT := toText({HBM_PERSNL.TERMINATE_DATE});

Iif (length(TermDT) > 0 ,
Iif (Date(TermDT) > {@Period to Date} or
(Month(date(TermDT)) + Year(date(TermDT))) = (Month({@Period to Date}) + Year({@Period to Date}))
, 'A' , 'Ex-Employees'),'A')


 
Open the help filed and do a search on "multi-pass reporting". The problem is that Crystal determines groups in pass #1, and the formula you want to group on is evaluating in pass #2.

Please post the {@Period to Date} formula since that is what seems to have to execute first. We may be able to modify things so that you can use them in the grouping.

~Brian
 
This is a bit clunky and not mine but it works ok.

{@Period to Date} formula is

//Converts Periods to Dates
WhilePrintingRecords;

//Define the Variables we need to calculate the Dates and if it is a Leap Year !
Numbervar EndMonth;
StringVar EndMonth_Str;
NumberVar Leap ;
BooleanVar LeapFlag := false;
Global DateVar MonthDT;


//First Work out the Calander year and month.
If {?@CURRENTPERIOD} Mod 100 < 8 then EndMonth := {?@CURRENTPERIOD}- 96 Else
EndMonth := {?@CURRENTPERIOD} - 8;
//Now Check End Date for a Leap Year and set LeapFlag to true when it is !
Leap := Int(EndMonth/100);

If (Leap mod 4) = 0 and (Leap mod 100) > 0 then LeapFlag := True Else
if Leap mod 400 = 0 then LeapFlag := True else
LeapFlag := False;


select (EndMonth Mod 100)
Case 1
: EndMonth_Str := "31" + "/" + "01" + "/" + CStr(EndMonth / 100,"####")
Case 2
:
select (LeapFlag)
Case True
: EndMonth_Str := "29" + "/" + "02" + "/" + CStr(EndMonth / 100,"####")
Case False
: EndMonth_Str := "28" + "/" + "02" + "/" + CStr(EndMonth / 100,"####")
Default
: EndMonth_Str := "28" + "/" + "02" + "/" + CStr(EndMonth / 100,"####")
Case 3
: EndMonth_Str := "31" + "/" + "03" + "/" + CStr(EndMonth / 100,"####")
Case 4
: EndMonth_Str := "30" + "/" + "04" + "/" + CStr(EndMonth / 100,"####")
Case 5
: EndMonth_Str := "31" + "/" + "05" + "/" + CStr(EndMonth / 100,"####")
Case 6
: EndMonth_Str := "30" + "/" + "06" + "/" + CStr(EndMonth / 100,"####")
Case 7
: EndMonth_Str := "31" + "/" + "07" + "/" + CStr(EndMonth / 100,"####")
Case 8
: EndMonth_Str := "31" + "/" + "08" + "/" + CStr(EndMonth / 100,"####")
Case 9
: EndMonth_Str := "30" + "/" + "09" + "/" + CStr(EndMonth / 100,"####")
Case 10
: EndMonth_Str := "31" + "/" + "10" + "/" + CStr(EndMonth / 100,"####")
Case 11
: EndMonth_Str := "30" + "/" + "11" + "/" + CStr(EndMonth / 100,"####")
Case 12
: EndMonth_Str := "31" + "/" + "12" + "/" + CStr(EndMonth / 100,"####")
Default
: EndMonth_Str := "";


MonthDT := date(EndMonth_Str)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top