Forum Stats

  • 3,837,530 Users
  • 2,262,268 Discussions
  • 7,900,315 Comments

Discussions

IF without members

Robert Angel
Robert Angel Member Posts: 4,535 Bronze Crown
edited Sep 21, 2017 2:52AM in Planning and Budgeting

Is it possible to have IF without members in PBCS business rules?

i.e. I would like some of my scripts sections to not execute when an external variable is set.

But trying the below, before introducing the variable, I get an error....

IF ( 1=2)

fix (&currforc, &curryear, working, local, basedata )
    agg("division", "cost Centre", "Entity", "Employee");
endfix

ELSE

fix (&currforc, &curryear, working, local, basedata )
    agg("division");
endfix

endif;

A validation error was received from the Planning server.
'Error:The CALC command [IF] can only be used within a CALC Member Block Rule CCplan.Wrkforce.Sysadmin Script'

n.b. The above is not what I want to do, just a first test of if I could get IF to work in this way to give me logic that I can apply outside of the Essbase cube?

Preferably I do not want a hybrid fudge of (say) adding my external variable to a value in essbase and then testing on that value.

Tagged:

Best Answer

Answers

  • Alex1
    Alex1 Member Posts: 1,391 Bronze Badge
    edited Sep 20, 2017 7:13AM

    Hello,

    "IF command" only can use inside calc member block.

    for example:

    FIX (members)

    Account(

         IF(Account==1)

              your code

         ELSE

              your code

         ENDIF

    )

    ENDFIX

    You can't use FIX command inside IF command.

    Regards

  • Robert Angel
    Robert Angel Member Posts: 4,535 Bronze Crown
    edited Sep 20, 2017 7:22AM

    Is there any alternative means then to introduce the equivalent of procedural logic into a business rule, such that based on an external parameter, numeric, text, whatever, you can have blocks of your code NOT execute based on a value that is passed in via a variable?

  • Alex1
    Alex1 Member Posts: 1,391 Bronze Badge
    edited Sep 20, 2017 7:31AM

    If you want that your code not execute some parts of your cube you should to use FIX statement and filter that you want to calc.

  • Robert Angel
    Robert Angel Member Posts: 4,535 Bronze Crown
    edited Sep 20, 2017 8:19AM

    This is more of the nature of a number of fixes that should not execute.

    Could a loop be used with break to prevent execution of a large subset of a calc script?

  • user9928941
    user9928941 Member Posts: 222
    edited Sep 20, 2017 10:52AM Answer ✓

    Hello,

    Per my understanding, you want to use a variable to decide whether or not to execute a business rule. Is that correct?

    Did you try using prompts (RTP or DTP) for external variable ?

    FIX cannot be used within IF. Rather it's the other way round.

    If you don't want to execute the FIX statement based on some condition, you could check the SET commands.

    You can check these links:

    http://essbasedownunder.com/2016/11/conditional-fix-statements/

    https://docs.oracle.com/cd/E40248_01/epm.1112/essbase_tech_ref/frameset.htm?set_runtimesubvars.html

    (which i assume you would already have).

    Still my two cents.

    Thanks,

    Pawan.

  • Robert Angel
    Robert Angel Member Posts: 4,535 Bronze Crown
    edited Sep 20, 2017 11:10AM

    Thanks,

    I agree the logic on both is less than obvious.

    Okay, it is not obvious at all.

    But this is exactly what I was looking for, and parallel to my thoughts on loop...

    Presumably I can set a subvar based on an external variable, passed in at runtime, or a substitution variable?

    SET RUNTIMESUBVARS {
      runForecast= &TimeToRunForecast;
      runBudget=&TimeToRunBudget;
    };

    AND

    SET RUNTIMESUBVARS {
      runForecast= {TimeToRunForecast};
      runBudget= {TimeToRunBudget};
    };

    Two cents very gladly received, points coming your way!

    Thank you!

  • user9928941
    user9928941 Member Posts: 222
    edited Sep 20, 2017 1:23PM

    Using a calculation manager variable with RTP would allow you to specify a value when the rule is run (upon form save for example).

    Using Essbase Substitution variable doesn't allow you to specify a value but would use the default value in Essbase.

    Thanks,

    Pawan.

    Robert Angel
  • Robert Angel
    Robert Angel Member Posts: 4,535 Bronze Crown
    edited Sep 21, 2017 2:52AM

    Many thanks again, hope I can return the favour one day!

This discussion has been closed.