Skip to Content

Sample code for adding a condition to a dataprovider in Raylight?

I'm assuming I need to update queryspec > queriesTree > boQuery > conditionPart > conditionTree, and add a new condition node. But I don't know if that's correct and what it should look like if so.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Mar 06, 2017 at 02:38 PM

    Hi Joe,

    Does the following help?

    https://archive.sap.com/discussions/thread/3937387

    Dan

    Add comment
    10|10000 characters needed characters exceeded

    • Thanks for your reply, Dan. That thread appears to relate to adding conditions with prompts; I just needed add a simple predefined condition.

      I did figure out how to do it, after a day of parsing XML and trial-and-error. Here's the process I found:

      • Make a call to /biprws/raylight/v1/universes/x for the applicable universe.
      • Locate the desired predefined condition, and retrieve its id property
      • Next, get the data provider: biprws/raylight/v1/documents/xxx/dataproviders/DPx
      • Check the dataSourcePrefix node. If it's there and not empty, then add its value and a period to the beginning of the predefined condition's ID
      • Next, get the query specification for the data provider: biprws/raylight/v1/documents/xxx/dataproviders/DPx/specification
      • Locate the following node:queryspec:QuerySpec/queriesTree/children/bOQuery/conditionPart/conditionTree
      • In this node, create a new element named "children"
      • Add an attribute named "xsi:type" with a value of "queryspec:ConditionDataNode"
      • Add an attribute named "logicalOperator" with a value of "Null"
      • Add an element to the new "children" node named "condition"
      • Add an attribute named "xsi:type" with a value of "queryspec:PredefinedCondition"
      • Add an attribute named "conditionType" with a value of "Predefined"
      • Add an attribute named "itemIdentifier". The value is the predefined condition's ID, with the data source prefix (if applicable)
      • PUT the updated queryspecification XML

      For what it's worth, the above could be done in about four lines in REBean.....

      Incidentally, I also discovered that specifying an invalid identifier for the predefined condition does NOT cause an error - the invalid reference is added to the document, and (of course) there's no apparent change in the query.