This discussion is archived
5 Replies Latest reply: Nov 2, 2013 7:32 AM by user10132385 RSS

Issue with an if Statement

Next Level Newbie
Currently Being Moderated


FIX(@LEVMBRS("Time",0) AND @DESCENDANTS("Total Year"),
"Operating Days"IF((("Gross restaurant sales" == #MISSING) OR ("Gross restaurant sales" == 0)) AND @ISMBR(@ATTRIBUTE("PreOpen")))
"Operating Days"=#MISSING;
"Traffic"=#MISSING;
"Days Open"=#MISSING;
ENDIF;)

 

"Operating Days"(IF(@ISMBR(@ATTRIBUTE("Franchise")) AND @ISDESC("OBS")),
"Operating Days"=#MISSING;
"Traffic"=#MISSING;
"Days Open"=#MISSING;
ENDIF;)

 

ENDFIX ;

 

But I getting the following Error

 

Error: 1200336 Error parsing formula for [FIX STATEMENT] (line 9): [(] without [)]

 

Please advise

  • 1. Re: Issue with an if Statement
    Celvin Kattookaran Oracle ACE
    Currently Being Moderated

    If you look at your calc script you have an extra "," in line 8 IF(@ISMBR(@ATTRIBUTE("Franchise")) AND @ISDESC("OBS")),

     

    Also you don't have an opening block for this line "Operating Days"IF((("Gross restaurant sales" == #MISSING) OR ("Gross restaurant sales" == 0)) AND @ISMBR(@ATTRIBUTE("PreOpen")))

     

    Well when i look at it there are more errors. And what I'm doing is what I hate to do. (write down the script for you, but i think it is easier that way)

     

    Try this script

     

    FIX(@LEVMBRS("Time",0) AND @DESCENDANTS("Total Year"))

    "Operating Days" (

      IF((("Gross restaurant sales" == #MISSING) OR ("Gross restaurant sales" == 0)) AND @ISMBR(@ATTRIBUTE("PreOpen")))

      "Operating Days"=#MISSING;

      "Traffic"=#MISSING;

      "Days Open"=#MISSING;

      ENDIF

      )

     

    "Operating Days" (

      IF(@ISMBR(@ATTRIBUTE("Franchise")) AND @ISDESC("OBS"))

      "Operating Days"=#MISSING;

      "Traffic"=#MISSING;

      "Days Open"=#MISSING;

      ENDIF

      )

     

    ENDFIX

     

    I've a question for you, if you are not doing a data check in the second condition why not just use CLEARDATA.

     

    Regards

     

    Celvin

  • 2. Re: Issue with an if Statement
    Next Level Newbie
    Currently Being Moderated


    Thanks Celvin

     

    if you have a better way too do this scripts I am open

  • 3. Re: Issue with an if Statement
    TimG Guru
    Currently Being Moderated

    I think the initial error is because the FIX has unbalanced parentheses.  NextLevel, the message tells you: : [(] without [)] - surely when you see that you start checking that your parentheses balance? I don't mean to be rude, but this is straightforward troubleshooting common to practically any language.

     

    The overall FIX is an odd construct:

     

    FIX(@LEVMBRS("Time",0) AND @DESCENDANTS("Total Year"))


    Are "Time" and "Total Year" in the same dimension?  If so, why not @RELATIVE("Total Year", 0)?  If not, why the AND?


    As Celvin says, the second block doesn't need an IF.  You could just FIX and CLEARDATA.  Couldn't the first block also use an additional FIX for @ATTRIBUTE("Pre-Open") rather than testing the attribute in an IF?  I think testing for an attribute in an IF will touch more blocks than FIXing with the attribute.

  • 4. Re: Issue with an if Statement
    Next Level Newbie
    Currently Being Moderated

    Time and Years are difference dimension

     

    again if you see a better way to write this script

     

    Please assist

     

    I need all the help I can with calc scripts

  • 5. Re: Issue with an if Statement
    user10132385 Journeyer
    Currently Being Moderated

    You don't necessarily need to use AND in FIX Statement. you can write it as below

     

    FIX(@LEVMBRS("Time",0), @DESCENDANTS("Total Year"),@ATTRIBUTE("PreOpen"))

    "Operating Days" (

      IF((("Gross restaurant sales" == #MISSING) OR ("Gross restaurant sales" == 0)))

      "Operating Days"=#MISSING;

      "Traffic"=#MISSING;

      "Days Open"=#MISSING;

      ENDIF

      )

    FIX(@ATTRIBUTE("Franchise")) AND @ISDESC("OBS"))

    CLEARDATA "Operating Days";

    CLEARDATA "Traffic";

    CLEARDATA "Days Open";

      ENDIF

      )

    ENDFIX

    ENFDIX


    Regards

    Amarnath

    ORACLE | Essbase

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points