If you are not going to acknowledge the assistance and provide feedback on whether it worked or not, I'd suggest you might struggle to get further assistance in the future if you need it.
Hi inkbird01 and welcome to TekTips.
It is always helpful to detail the actual result of anything you have tried, rather than saying 'No luck'. Did it return an error? How did the results vary from what you were expecting?
Try the following in the Record Selection Formula:
[Code...
If you are not going to acknowledge the assistance and provide feedback on whether it worked or not, I'd suggest you might struggle to get further assistance in the future if you need it.
I've now had an opportunity to test my approach and the Last Name formula did not work for the example where the two initials were the same (ie, "J J Smith").
The following amendment for the Last Name formula does work for all examples provided, but of course does need to be tested more widely...
Actually, the Last Name formula will not work for the cases where just one name has been entered. You will therefore need to add a test to the Last Name formula to check for a space, and where one does not exist, return the field value.
It will be a day or 2 before I get access to a machine...
Hi
I don't have access to Crystal Reports at the moment to validate the syntax of these formulas, but I think the following will work:
First Name
SPLIT({Table.NameField}, ' ')[1]
Last Name
TRIM(REPLACE({Table.NameField}, SPLIT({Table.NameField}, ' ')[1], ''))
Hope this helps.
Cheers, Pete
Because my code checks both the employee name and end date fields with the previous record, it is only the first row on change of either group where this will work, therefore my formula needs to be in the GH rather than the GF.
So, move the {@CalulateTotalHoursForSick} formula from GF2 to GH2...
I've just had another look.
Your amendment to the {@Hours} formula looks to be correct. If you move that formula to GF2 and suppress it (it is only for the purpose of calculating the totals sought, not for display) and move the {@Hours Dislpay} formula provided (which you seem to have ignored...
The report and data structure is still unclear to me, and I don't have time to try and dummy up some data so I can replicate your exact situation.
If you are happy to post a copy of the report file (suitably de-identified if preferred) I am happy to take another look.
Pete.
Hi POrlowski and welcome to Tek-Tips.
I got the required result by doing the following:
1. Create the following formula, place it in the Details section and suppress it:
[Code {@Hours}]
WHILEPRINTINGRECORDS;
Global NumberVar HRS;
If OnFirstRecord
Then HRS := {Table.Hours}
Else
If...
Hey John.
I think the best approach would be to add the object to the report, then use conditional suppression so it is not displayed unless the part number matches.
Cheers, Pete
Remove the line:
"rowNum := 0;"
As it is currently, you are setting the variable to 0, then adding 1 for every line, hence the result is 1 for every line.
A SQL Expression can only return a single value. If you know how to achieve what you want using a SQL query, copy that query into a Command and use that as the basis for your report.
Pete.
OK, try this:WHILEPRINTINGRECORDS;
Add the following RESET formula to the Group Header:
[Code {@VAR_RESET}]
WHILEPRINTINGRECORDS;
Global StringVar RESULT := '';
Global NumberVar INST := 1;
''
[/CODE]
Change the DISPLAY formula in the Group Footer to:
[Code {@}Display_Result]
Global StringVar...
While I remain happy to help, I do expect that OP will at least acknowledge the attempt and indicate whether it worked or not.
I really am beginning to understand why there are so few of us here still trying to assist.
It looked like an interesting challenge, so I thought I would have a go at it.
Assuming you do not care about Public Hoildays and that Weekends simply have no data I did it this way:
1. Create the following Formula and place it in the Details Section:
[Code {@Calculate_Result}]...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.