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

Formula field Value based on Comparison

Status
Not open for further replies.

IvySkye

Technical User
Dec 28, 2006
10
0
0
US
I had a report in Crystal were I built a formula field. The field would display one of two records based on the limit exceeded. I can't seem to figure out how to do the same thing in Actuate. The field was something like this. Any help would be greatly appreciated.

if (measurement.measurementvalue)>=(measurepoint.upperaction)
then (measurepoint.upperaction)
else
if (measurement.measurementvalue)<=(measurepoint.loweraction)
then (measurepoint.loweraction)

I tried putting this in a method OnRow but get the follow (Greek) error.

NewReportApp::Frame::MeasurementMeasurementvalueControl1%OnRow%AcDataRow(5): Actual: [new line] Expecting: '&', '*', '+', '-', '/', '<', '=', '>', '\',
'^', And, BAnd, BOr, Eqv, char 324, Imp, Is, char 338, Like, Mod,
char 362, Or, Then, Xor

1 Error(s) found
 
Try it like this (In the Sub OnRow Method)

If (measurement.measurementvalue)>=(measurepoint.upperaction)
then (measurepoint.upperaction)
Elseif(measurement.measurementvalue)<=(measurepoint.loweraction)
then (measurepoint.loweraction)
Endif

However note that you have a confusion of values in that you have something Greater Than or Equal To and Less Than or Equal To
 
Yes, this worked in Crystal. I want the measurement value compared to upper action limit and the lower action limit. Depending on which value the measurement exceeds, I want the exceeded limit displayed in this field. In Crystal it was a formula field. Perhaps I can't do the same thing in Actuate. The above suggestion did not work. Same error received.
 
one method I use is to create a variable (lets call it mynewvar) in the DataRow object and then override the DataRow's onread method like so:

Sub OnRead( )
Super::OnRead( )
' Insert your code here
if me.measurementvalue >= me.upperaction then
me.mynewvar = me.loweraction
elseif me.measurementvalue <= me.loweraction
me.measurementvalue = me.loweraction
end if
End Sub

the me. stuff is extraneous but points out that variables
are properties of the DataRow object.

You could also embed the logic in the sql itself (use IIF or case stmt) you should also be able to get the onrow to work, but you need to have assignments, unlike crystal formulas. lmk.
 
Oops, noticed I typed Endif instead of End If.

IIF is something like this
IIF(measurement.measurementvalue>=measurepoint.upperaction,measurepoint.upperaction,measurepoint.loweraction)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top