Hi
I didn't know whether to post this as a question - Is there a better place to do this ...
or as a feature request - Please don't change the way you validate browse records...
or as a Tip/Trick - Here is a way to make a file loaded browse from a Queue . . .
So I'll opt for the 'Maybe there is a better place to do this -
I'm displaying a distribution of some data. So I run through my file and load all the values into a queue so I can aggregate the values and calculate the cumulative counts and percents to total, etc.
I n order to do that without creating a memtable, a pre-process and a separate procedure for the result browse, I put some code like this into the Validate Record embed.
========================
!Load the queue and cycle. When it breaks it will display the queue
PerfRecord :=: Per:Record
rg :=: WorkGroup
x# = CalcFactors(PerfRecord,rg)
WorkGroup :=: rg
Clear(ResultQ)
ResultQ.dValue = WorkGroup.dValue
get(ResultQ,ResultQ.dValue)
if error()
clear(ResultQ)
ResultQ.dValue = WorkGroup.dValue
Add(ResultQ,ResultQ.dValue)
get(ResultQ,ResultQ.dValue)
end
Resultq.dCount+=1
totrecs += 1
put(ResultQ,ResultQ.dValue)
END !Loop - This processes the next record from the file
!=================================================================
!Now our own display Loop
sort(ResultQ,ResultQ.dValue)
CumCount=0
loop Rqi# = 1 to (records(ResultQ)+1)
If RQi# > Records(ResultQ) !ErrorCode() !Simulate an end of file error
if loc:rowstarted
packet = clip(packet) & '</tr>'&CRLF
do AddPacket
loc:rowstarted = 0
End
Break
END
get(ResultQ,RQi#)
CumCount += ResultQ.dCount
Resultq.dCumCount = CumCount
Resultq.dCumPercent = round(100*CumCount/TotRecs,.01)
put(ResultQ)
!This loop is completed by the template which has the Resultq fields to display
=========================================
This works like a charm since the Browse is file-loaded and there is no going backward to worry about.
Of course, if Bruce decides to use a record validator method call rather than some embedded code here, I'm may be sunk!
If anyone knows of a better solution, I'm open to suggestions.
Thanks,
Chris C.