Class IfFunction

  • All Implemented Interfaces:
    AnalyticsValueStream

    public class IfFunction
    extends AnalyticsValueStream.AbstractAnalyticsValueStream
    An if-else mapping function.

    Three arguments are required. The first, the conditional parameter, must be a BooleanValue and the later two, the if and else parameters, can be any type of AnalyticsValueStream. For each document, if the conditional value is true then the if-value is used otherwise the else-value is used.

    The resulting Value or ValueStream will be typed with the closest super-type of the two non-conditional parameters. (e.g. "if"(boolean,double,int) will return a double) If two AnalyticsValues are passed as the if-else parameters, an AnalyticsValue will be returned. If either parameter isn't single-valued, a AnalyticsValueStream will be returned.