Question

I have this :

IIF ({REPORT_INVOICE_SUMMARY.ITEMCONCAT} = 'Daywork',
        {REPORT_INVOICE_SUMMARY.QUANTITY},
        0)

What is this doing? and how can i add another check for say a Nightwork item? would it be like this?

IIF ({REPORT_INVOICE_SUMMARY.ITEMCONCAT} = 'Daywork' or {REPORT_INVOICE_SUMMARY.ITEMCONCAT}= 'Nightwork',
        {REPORT_INVOICE_SUMMARY.QUANTITY},
        0)
Was it helpful?

Solution

You really should refer to the the documentation on IIF:

IIF (expression, truePart, falsePart)

Description

IIF returns one of two parts, depending on the evaluation of the expression.

Arguments

• expression is a Boolean expression.

• truePart is the value returned if expression is True. It can be any simple type (Number, Currency, String, Boolean, Date, Time or DateTime) or range type (Number Range, Currency Range, String Range, Date Range, Time Range or DateTime Range), but it may not be an array.

• falsePart is the value returned if expression is False. It must be of the same type as truePart.

So this:

IIF ({REPORT_INVOICE_SUMMARY.ITEMCONCAT} = 'Daywork',
    {REPORT_INVOICE_SUMMARY.QUANTITY},
    0)

Basically says:

IF REPORT_INVOICE_SUMMARY.ITEMCONCAT = 'Daywork' THEN 
    REPORT_INVOICE_SUMMARY.QUANTITY 
ELSE 
    0

You can write your second example using an IN statement:

IIF ({REPORT_INVOICE_SUMMARY.ITEMCONCAT} IN ["Daywork", "Nightwork"],
    {REPORT_INVOICE_SUMMARY.QUANTITY},
    0)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top