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

Maximum Value of Computed field 1

Status
Not open for further replies.

MaumeeScott

Technical User
Jan 29, 2004
25
US
I am attempting to Return the Maximum Value of a Computed field in the content frame. The follwing is the Override Method on the content frame which essentially counts the number of null fields in a record.

Sub OnRow( row As AcDataRow )
Super::OnRow( row )
Dim NullCount As Integer
NullCount = 0
if IsNull(row.getvalue("location.Country")) then let NullCount = NullCount + 1
if IsNull(row.getvalue("location.State")) then let NullCount = NullCount + 1
if IsNull(row.getvalue("location.County")) then let NullCount = NullCount + 1
if IsNull(row.getvalue("location.postcode")) then let NullCount = NullCount + 1
if IsNull(row.getvalue("location.City")) then let NullCount = NullCount + 1
datavalue = NullCount
End Sub

I would like to return the Max value of this computed field on the after frame.

Thanks as always.

Scott
 
You can try this:

1. Create a double control in the After Slot frame to hold the Max value.

2. Create a static variable called MaxCount in that control
Name: MaxCount
Type: Integer
Storage: Static
Visibility: Public

3. Specify Count() in the ValueExp property, to find the number of rows. THIS IS IMPORTANT.

4. Override the OnRow method of that control as follows:
Sub OnRow( row As AcDataRow )
Super::OnRow( row )

Dim NullCount as Integer

if IsNull(row.getvalue("location.glaccout")) then let NullCount = NullCount + 1
if IsNull(row.getvalue("location.region")) then let NullCount = NullCount + 1
if IsNull(row.getvalue("location.state")) then let NullCount = NullCount + 1
if IsNull(row.getvalue("location.postalcode")) then let NullCount = NullCount + 1

if NullCount > MaxCount then
MaxCount = NullCount
end if


End Sub

5. Override the Finish method of the control as follows:

Sub Finish( )
Super::Finish( )

DataValue = MaxCount

End Sub

I hope this helps.

-- JB
 
Thanks again John! You have been a tremendous help and I can't thank you enough.

Scott
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top