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!

can't sum with text in the fomula

Status
Not open for further replies.

edwindow

Programmer
Jul 13, 2001
51
US
I have a formla that returns a number as a value however I can not sum on the field because within the If/Then statement I have a text field comparison. Example of my code
if(({SECURITY_PROFILE.FULLNAME}<>previous({SECURITY_PROFILE.FULLNAME})) and ({TW_V_TRNSTOT.TRANSTOTAL}<35)) then 1

The fullname is the text field. Everything else is of number type.

I have this formula in the detailed section however I do not have access to the summary field due to that fullname comparison. Is there a way to get around that?

Eddie
 
Ed,

This formula should be able to be summed. What error message are you getting?

Also, lets back up a bit and determine if this is even the best approach to your problem. What is it you are trying to accomplish?
Software Training and Support for Macola, Crystal Reports and Goldmine
714-348-0964
dgilsdorf@mchsi.com
 
You could get around this by doing your adding up in the formula instead.

i.e.

WhilePrintingRecords;
NumberVar AddUp;

if(({SECURITY_PROFILE.FULLNAME}<>previous({SECURITY_PROFILE.FULLNAME})) and ({TW_V_TRNSTOT.TRANSTOTAL}<35)) then
AddUp := AddUp + 1

Naith
 
I have to do this approach mainly because of the tables I am using. My overall objective is to get the total number of employees with hours less than 35. Seems simple but based on the way I have to link the tables, I am getting duplicate records. So I tried to make a formula that basically took the first record. Which it does correctly. But I look to apply the summary function to this field and it is not available and I get a summary error when I tried to use the sum function that includes this formula. I am thinking it is because I have that full name(string) comparison to eliminate the duplicate records. If I take the full name condition out, it works fine but I am stuck with the duplicate records which inflates my summary. I am linking to a transaction table, which has multiple entries so that is why I get the duplicate records.
 
Naith,
This is a good idea however it sums the numbers throughout the entire report. I have things broken down by department. I tried to change the condition so that it stoped at the group department level but I got an error that said the group is not a repeating field/function etc.

Eddie
 
Where you want the counter reset, you have to place a resetting formula. Namely:

WhilePrintingRecords;
NumberVar AddUp := 0;

Naith
 
Edwindow-

Use a Running Total field. Insert, Field object, Running total field, insert the field to summarize, evaluate on change of group (rather than every record) and reset as desired.

Let me know if you have any questions. Software Training and Support for Macola, Crystal Reports and Goldmine
714-348-0964
dgilsdorf@mchsi.com
 
just to add to Naith's comment

if the counter reset is placed in a group header you should modify the code a bit

WhilePrintingRecords;

if not inrepeatedGroupHeader then
NumberVar AddUp := 0;

this prevents accidental reset if a group straddles 2 pages....also you should place this field suppressed in the header Jim Broadbent
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top