;------------------------------------------------------------------------------------------------------------------------------------------ #DefineSubRoutine udfIIF (ConditionalExpr, TrueValueExpr, FalseValueExpr) If ConditionalExpr Then Return TrueValueExpr Return FalseValueExpr #EndSubRoutine ;------------------------------------------------------------------------------------------------------------------------------------------ ; Testcase 1. intProgVer = 11 strProgType = "STANDARD" ; strAnswer = "eleven" strAnswer = udfIIF (intProgVer == 11, "eleven", "other") Message ("Test 1: udfIIF (ConditionalExpr, TrueValueExpr, FalseValueExpr)", "Answer = " : strAnswer) ; strAnswer = "70" ; Nested UDF's work fine too. strAnswer = udfIIF (intProgVer == 11, udfIIF (strProgType == "STANDARD", 70, udfIIF (strProgType == "PRO", 75, 0)), 99) Message ("Test 1: udfIIF (ConditionalExpr, TrueValueExpr, FalseValueExpr)", "Answer = " : strAnswer) ; Testcase 2. intProgVer = 12 strProgType = "PRO" ; strAnswer = "other" strAnswer = udfIIF (intProgVer == 11, "eleven", "other") Message ("Test 2: udfIIF (ConditionalExpr, TrueValueExpr, FalseValueExpr)", "Answer = " : strAnswer) ; strAnswer = "99" ; Nested UDF's work fine too. strAnswer = udfIIF (intProgVer == 11, udfIIF (strProgType == "STANDARD", 70, udfIIF (strProgType == "PRO", 75, 0)), 99) Message ("Test 2: udfIIF (ConditionalExpr, TrueValueExpr, FalseValueExpr)", "Answer = " : strAnswer) ; Testcase 3. intProgVer = 11 strProgType = "PRO" ; strAnswer = "eleven" strAnswer = udfIIF (intProgVer == 11, "eleven", "other") Message ("Test 3: udfIIF (ConditionalExpr, TrueValueExpr, FalseValueExpr)", "Answer = " : strAnswer) ; strAnswer = "75" ; Nested UDF's work fine too. strAnswer = udfIIF (intProgVer == 11, udfIIF (strProgType == "STANDARD", 70, udfIIF (strProgType == "PRO", 75, 0)), 99) Message ("Test 3: udfIIF (ConditionalExpr, TrueValueExpr, FalseValueExpr)", "Answer = " : strAnswer) Exit ;------------------------------------------------------------------------------------------------------------------------------------------ ; (c)Detlev Dalitz.20020626.20100206. ;------------------------------------------------------------------------------------------------------------------------------------------