In short - "
no, not really".
--
I have managed to get something
like that to work, but it relies on a database value somewhere;
I have an object which has different "versions" and the calculated score algorithm varies as per the version of the object instance, so I need an IF/THEN/ELSE logic in the calculated attribute.
i.e. my logic is IF version_01 then score = ( A + B + C ) ELSE IF version_02 then score = ( B + C + D ) etc ( A,B,C,D are just other attributes on my record)
And I can do this in my calculated attribute because I have a boolean attribute that indicates which version I am looking at, i.e. my record EITHER has version_01 = 1 OR version_02 = 1 (and this is always the case).
So I can build the calculated attribute like this;
version_01 * ( A + B + C ) + version_02 * ( B + C + D)
However, I can not see how I could get that to work in
your case unless you had an boolean attribute called "
field2_or_field3_equals5" which was either or 1... and you'd need to
maintain that attribute somehow automatically* (i.e. through a back end SP/GEL/XOG procedure) and once you start building a backend process, you might as well just get the backend process to populate an attribute on your object (which is what NJ is suggesting cool)).
* - it has to be a "real" attribute and not another calculated attribute since you can't build calculated attributes using other calculated attributes (which is reasonable because you can not guarantee their calculation sequence!)
--
HOWEVER there is an alternate solution perhaps.... if you build a parametrised lookup, which takes the record instance ID as the parameter, then you can "code" the IF/THEN/ELSE logic in the NSQL for the lookup and return a display value as your calculated score, the lookup needs to ALWAYS return "1" as its hidden key and you then need a dummy attribute on your object that always has the value "1" to associate the lookup to - then you can use that dummy attribute as a display-only, pull-down lookup and it will display your calculated score OK. I have written about this technique a few times on these boards (I'll see if I can find the links with a bit more explanation in).
NOTE that this solution will only work on the main object maintenance screens (i.e. the EDIT view) , it will not work on a LIST view (because of a limitation in parametrised lookups). If you need the data on a LIST view, a backend solution is the only thing I think will work.
EDIT: more info on this technique here ;
Resource (General) page: how to display info from secondary page?
and here ;
Dynamic Query Lookup
(one day, if I get some time and inclination, I might write this technique up "properly" as a "tip" rather than keep trying to explain it (badly) every time it comes up! :ph34r: )