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

RETRIEVING CERTAIN INFO OUT OF A FIELD

Status
Not open for further replies.

mmt4331

Programmer
Dec 18, 2000
125
US

I have a field that consists of either "DayShift" and "NightShift". What formula can one use to retrieve the Dayshift out of the shift field...and show it on the report?
 
You can create a new formula field and use a formula like this:

if ({shift field}="DayShift")
then {shift field}
else " "
 
Thx! It worked...one more question....

When my shift field doesn't equal "dayshift" it puts a space out there...how can I get rid of the spaces?

Thx.
 
Where can I find the 'suppress blank section' at? I tried to format the field and got the dialog box up - popped a formula in there..but it still won't suppress the blanks. I'm using CR6.0.
 
Never mind, I found it....I suppressed blank section, and it still won't work.

thx.
 
I use CR7. But try and right click in your design tab. That is, the header, detail or footer your information is in and there should be something called 'format section...' Again, this is CR7 so it could be a little different for 6.
 

I tried the format section and it takes me to the Section Expert. I checkmark the 'Suppress blank Section' and it still doesn't work. But in our formula (that you put out) - if my db.field didn't equal dayshift, we would put a space there. Is a space equal to a blank? And should we arrange the else portion of the formula to: else null?
 
Do you have a space in the " " for the blank? If so, that is where your space is coming from, try doing the double quotes without the space, as in "". That should eliminate your space.
 
I got it working now (thanks BradW and StormTrooper!).

Now I'm trying to Grand Total on the same field (one for how many dayshift and then how many nightshift). I put a grand total in the RF for both fields, but I keep getting the same for each field. for example:

DayShift NightShift
127 127

I also put two different formulas for both these fields, but it comes up w/ the same. It should look something like this:

DayShift NightShift
57 215

If someone can help, I would appreciate it!
 
Can someone still help me from the above note.
 
I've run into the same problem...I think. See post called 'Need help with counts' So I'm working on it. Sorry.
 
Create two formulae
1)Daycount

if ({shift field}="DayShift")
then 1 else 0


2)NightCount

if ({shift field}="NightShift")
then 1 else 0

Insert grand totals for the above under the appropriate column
 
BigFuzzyDog, try this.

What I did was create 4 new formulae. An Increment formula, an Initialize formula and 2 Total formulas, one for DayShift and for NightShift.

Formula 1: '@Increment'

WhilePrintingRrecords;
NumberVar DayShiftCount;
NumberVar NightShiftCount;
If ({shiftfield}="DayShift")
Then DayShiftCount:=DayShiftCount+1
Else NightShiftCount:=NightShiftCount+1

Formula 2: '@Initialize'

NumberVar DayShiftCount:=0;
NumberVar NightShiftCount:=0;

Formula 3: '@DayShiftTotal'

WhilePrintingRecords;
NumberVar DayShiftCount;
DayShiftCount

Formula 4: '@NightShiftTotal'

WhilePrintingRecords;
NumberVar NightShiftCount;
NightShiftCount

What you do is insert formula '@Increment' into your detail section somewhere and suppress it because it does not have to be seen.

Then insert formula '@Initialize' into your group header and suppress that as well.

Next is your 2 total formulas, '@DayShiftTotal' and '@NightShiftTotal'. You put these in your report header.

Hope this works for you.
 
Re the count problems, do you have all of your records in one group? If so, that is your problem, Crystal will not count your different groups in a report footer.

My suggestion would be to group by your shift field, so that you have one group of day-shift and one group of night-shift. Then insert a SUB-TOTAL or SUMMARY to count each group total. This summary is inserted into the group footer.

Finally, insert a GRAND TOTAL on the same field in the report footer.

This should give you both a count for each group and a grand total for all records.

Hope it helps, let me know if you have quesitons.
 
U can try running total fields for this. IN the insert menu there is the running total field option. Click on that and use the create new option. Then select the field to be totaled and if you want it to be each group u can specify that or u need a grand total that option is also there. If there conditions that has to be evaluated then specify that condition in the evaluate section using the formula.

I hope u'll get it right. I use this and it is very effective and easy.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top