getDataExport with rule calculated values

      getDataExport with rule calculated values


      Quetsion 1)
      is there a possibility to toggle export of rulecalculated values in getDataExport such as setBaseCellsOnly and setIgnoreEmptyCells?

      Question 2)
      I expect e.g.

      Condition cond2 = ec2.createCondition("==", 1);
      ExportDataset myset2 = cb2.getDataExport(ec2);

      to return only cells that got value 1 but it does not seem to work. Any idea?
      Thanks in advance.


      Post was edited 1 time, last by “h_decker” ().

      RE: getDataExport with rule calculated values


      1.: No, currently, there is no such functionality.

      2.: This works for me:

      ConnectionConfiguration cfg =
      getConfiguration("localhost", "7777", "admin", "admin");
      Connection con = ConnectionFactory.getInstance().newConnection(cfg);
      Database db = con.getDatabaseByName("Demo");
      Cube cube = db.getCubeByName("Sales");
      ExportContext cont = cube.getExportContext();
      Condition cond = cont.createCondition("==", 853.0);
      ExportDataset data = cube.getDataExport(cont);
      while (data.hasNextCell()) {
      Cell cell = data.getNextCell();
      if (cell == null) {
      } else {
      for (Element e: cell.getCoordinate()) {
      System.out.print(e.getName() + ", ");

      The output is as expected:
      Desktop L, France, Jan, 2002, Budget, Units, 853.0
      Desktop L, France, Jan, 2002, Approved, Units, 853.0

      So, maybe you don't have a cell with the number 1?


      RE: getDataExport with rule calculated values

      Well, I tried 1 and 1.0 as a filter. The 1 in coord A is calculated by rule. My result looks like this:
      coord: 0001 0026 A 2057 value: 1.0
      coord: 0001 0026 A 2058 value: 1.0
      coord: 0001 0026 A 2059 value: 1.0
      coord: 0001 0026 A 2060 value: 1.0
      coord: 0001 0027 B 1990 value:
      coord: 0001 0027 B 1991 value:
      coord: 0001 0027 B 1992 value:
      coord: 0001 0027 B 1993 value:
      coord: 0001 0026 X 2060 value: 1.0

      When I use ec2.setIgnoreEmptyCells(true); then I got only
      coord: 0001 0026 X 2060 value: 1.0

      which is a physically entered value.

      So first solution would be fine if the 0 weere suppressed. Adding another condition or using !=0 does not work.


      Post was edited 3 times, last by “h_decker” ().

      Hi Holger,

      I have got a problem with rule getting rule calculated values from Exportcontext.
      I never get the value from cells that are calculated by rules via ExportContext

      You asked if it is possible to disable getting rules, so I think you already get values for these cells.

      In Excel everything works fine, but a really strange thing is, that I can save a value to a rule calculated cell and the next time I call getExportContext I get that value.
      In Excel I only get that value if I delete or deactivate the rule.

      This is my code to get the data

      Source Code

      1. ExportContext ec = cube.getExportContext(area);
      2. ec.setIgnoreEmptyCells(false);
      3. ec.setBaseCellsOnly(false);
      4. ExportDataset dataset;
      5. while (ec.getProgress() < 1.0) {
      6. dataset = cube.getDataExport(ec);
      7. while (dataset.hasNextCell()) {
      8. //do something
      9. //rule calculated cells are in the dataset but without value
      10. }
      11. }
      12. ec.reset();

      have you experienced a behavior like that?

      I'm not a java pro, but this snippet worked for me. Check out if there is a new api version with the "setUseRules". I just got a beta for this.

      But I don't know how to do the code quotes :)


      ExportContext ec2 = cb2.getExportContext(); ec2.setBaseCellsOnly(true);
      ExportDataset myset2 = cb2.getDataExport(ec2);

      cell2 = myset2.getNextCell();

      Post was edited 2 times, last by “h_decker” ().

      Hi Holger,

      thanks for your reply, I just got the beta from tensegrity and everything works fine!

      Originally posted by h_decker
      But I don't know how to do the code quotes :)

      Just click on the "#" button above the editor ;)
      That will insert the following tags:

      [ CODE] code snippet [ /CODE]
      Hi Holger,

      did you or anybody already used the Methods
      Cell.getRuleId() or
      Cell.hasRule() ?

      getRuleId always returns null, and hasRule always returns false

      as workaround I can use this for now.

      Source Code

      1. Rule myRule = cell.getCube().getRule(cell.getCoordinate());
      2. String myRuleId = myRule.getId()

      and as a workaround for hasRule I simply check if myRule isn't null.

      Is there a way to get the rule by only the ruleId?
      The only methods to get rules are

      Source Code

      1. Rule Cube.getRule(Element[] coordinate)
      2. Rule[] Cube.getRules()

      The ruleId can only be used for removing a rule from a cube.

      Thanks for your help,

      Post was edited 2 times, last by “Thomas147” ().