Basic Rule Question about combine rule syntax

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Basic Rule Question about combine rule syntax

      I'm new in palo product. I have quite easy question but i can't solve.

      Rule#1 ['Jan', '2011', 'GT1B', 'Energy Previous Date'] = PALO.DATA("Plant", "Daily",
      "2",
      !'Months', !'Years', "GT1B", "Energy Current Date")
      I work correctly. but I replace "2" with rule to find previous day.


      Rule#2
      ['Jan', '2011', 'GT1B', 'Energy Previous Date'] = PALO.DATA("Plant", "Daily",
      DATEFORMAT(DATE(VALUE(!'Years'), VALUE(PALO.DATA("Plant", "#_Months", "No of Month", !'Months')), VALUE(!'Days') - 1), "\D"),
      !'Months', !'Years', "GT1B", "Energy Current Date")


      My question is it possible to combine rule like rule#2 and what am i wrong syntax?
      Thanks and sorry about my english
      Regards
    • With your model with three time dimensions you will need many rules in order to check for month end days/year end days.
      You may consider first if one time dimension in your "Daily" cube - consisting of base elements like "2011-01-01" in a day/month/Year hierarchy - supports your business case. Then you could write your rules with the help of an attribute "Previous_day" for your days elements. Attribute values are defined once then.
      In other cubes on top of this base cube you could nevertheless use more time dimensions.
    • Dear Kratzer.
      I understand you comment but following rule is work correctly.

      ['Jan', '2011', 'Comment', 'Energy Previous Date'] =
      STR(
      PALO.DATA("Plant", "Daily",
      DATEFORMAT(DATE(VALUE(!'Years'), VALUE(PALO.DATA("Plant", "#_Months", "No of Month", !'Months')), VALUE(!'Days') - 1), "\D"), DATEFORMAT(DATE(VALUE(!'Years'), VALUE(PALO.DATA("Plant", "#_Months", "No of Month", !'Months')), VALUE(!'Days') - 1), "\M"), DATEFORMAT(DATE(VALUE(!'Years'), VALUE(PALO.DATA("Plant", "#_Months", "No of Month", !'Months')), VALUE(!'Days') - 1), "\Y"),
      "GT1B", "Energy Current Date"),
      10, 2)


      Different between this code is only receiver is String. When receiver is number. calculation value is 0.
      Is it program bug?


      Regards,
    • This rule returns the previous day, assuming your elements in the days dimension are sorted by element index. You could use attribute values for your !days elements instead of the index - see my previous post. It may be safer.
      It may give you at least an idea for proceeding with your solution.

      Source Code

      1. ['Jan', '2011', 'GT1B', 'Energy previous date'] = B: PALO.DATA("Plant", "Daily", PALO.ENAME("Plant", "Days", PALO.EINDEX("Plant", "Days", !'Days') - 1), !'Months', !'Years', "GT1B", "Energy current date")