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!

Supressing multi countings in cross tab

Status
Not open for further replies.

bidra

Programmer
Feb 28, 2002
31
DE
CR 10

Hello,

I have an urgent problem here:
The data rows come sorted by firm number an property LP.
Now I need a formula, that counts every occurrence of firm number with property LP.
But the firm number is to count only once, if the property LP occurs more than once out of (1621,1623).

I tried it with global variables but this doesn't work:

The code for the formula goes like this:

--------------------------
WhileReadingRecords
Global FirmNum as number
Global MultKey as number

formula = 0

If FirmNum <> TAB1.FirmNum } Then
FirmNum = {TAB1.FirmNum }
MultKey = 0
End If

If {TAB1.LP} = 1621 or {TAB1.LP} = 1623 Then
MultKey = MultKey + 1
End If

If {TAB1.LP} = 1621 or {TAB1.LP} = 1623
if MultKey < 2 then
formula = + 1
end if
else
formula = + 1
end if
--------------------------

The formula results show that global variable are not set and changed properly, eg. 2 instead of 1 .

Did I use the global variable not correctly or is there a different solution to my problem ?

Many thanx in advance

bidra
 
Try posting technical information in addition to what you're trying that doesn't work.

Crystal version
Dtaabase/connectivity used
Example data
Expected output

-k
 
You should be able to perform a distinct count on Property LP
 
... I think the key to my problem is, if global variables can be use in formulas of cross tabs at all.

Do you have an idea?

bidra
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top