Probably a dumb question, but I am new in Infopath, I'm trying to anyway
develop a report for my company.
In a field, I am computing the Net Loss after insurance value. The insurance
value is , let's say 100 USD, so, if the Loss is above this value, the
NetLoss = Loss - 100, and if Loss is below 100, NetLoss = Loss.
In total, a good formula is: NetLoss = Loss - max (Loss - 100,0)
How can I compute this in a field, since all math functions appear to only
relate to repetitive fields from tables?
Regards,
FH
KjellSJ - 29 Apr 2005 11:29 GMT
Add an 'Expression box' control for your NetLoss field and the function (fx)
button for the 'XPath' field in the poup dialog. Enter your formula "Loss -
max (Loss - 100)", verify it and click OK twice.
> Probably a dumb question, but I am new in Infopath, I'm trying to anyway
> develop a report for my company.
[quoted text clipped - 11 lines]
> FH
>
felix1093 - 29 Apr 2005 20:46 GMT
Thanks for your reply.
Unfortunately I did not succeed to implement the max(0,Loss-100) function.
Can you copy/paste the expression with Xpath?
regards,
> Add an 'Expression box' control for your NetLoss field and the function (fx)
> button for the 'XPath' field in the poup dialog. Enter your formula "Loss -
[quoted text clipped - 15 lines]
> > FH
> >
KjellSJ - 30 Apr 2005 08:48 GMT
You're quite right that you cannot use max() on two separate fields.
As an alternative, use rules on the Value and Loss fields to set the value
if the NetLoss field. You will need to have two rule conditions, one for when
Loss>Value (1), and one for when Value>=Loss (2). Setting the NetLoss will
then be either (1) =Loss-Value or (2) =Loss.
You could also use OnAfterChange scripts on the same fields to do the
calculations.
Note that in both solution your user will have to actually change the
content of one of the fields to trigger the calculation.
KjellSJ (http://kjellsj.blogspot.com)
> Thanks for your reply.
> Unfortunately I did not succeed to implement the max(0,Loss-100) function.
[quoted text clipped - 21 lines]
> > > FH
> > >