Planning

Get Involved. Join the Conversation.

Topic

    Brian M
    trouble passing multiple RTP's in Rest api Business rule...Answered
    Topic posted October 1, 2019 by Brian MBlue Ribbon: 750+ Points, tagged Groovy, Planning 
    40 Views, 2 Comments
    Title:
    trouble passing multiple RTP's in Rest api Business rule execution
    Content:

    Thanks to Manfredi's help I have code to execute a business rule using a Rest call.  It works beautifully for a business rule that has one RTP.  I'm having trouble trying to adapt it so that I can pass more that one RTP parameter into the business rule. In other words I'd like to create another string variable similar to sEntity to capture a second POV dimension member then pass it in as a second parameter 

    //Get the Current Entity from POV
    String sEntity = operation.grid.pov.find{it.dimName =='Entity'}.essbaseMbrName

    Map<String, String> Params = new HashMap<String, String>()

    Params.put('vEntity',sEntity)

     HttpResponse<String> jsonResponse = operation.application.getConnection("JOBS").post()
     .header("Content-Type", "application/json")
     .body(json(["jobType" : "RULES", "jobName" : "GroovyAliasUpdater2","parameters":Params ])).asString()

    println jsonResponse.body

    Best Comment

    Anthony Manfredi

    Brian what I built was a map, so it's easy for you to add additional params without changing the call.  

    Here I added the Scenario as a Second RTP to the parameter map. 

    //Get the Current Parent User Entity from the User Variable
    
    UserVariable UserEntity = operation.application.getUserVariable("TOPENTITY")
    def selectedEntity =UserEntity.getValue().toString()
    
    DataGrid curgrid = operation.getGrid()
    def curscenario=curgrid.pov.find{it.dimName =='Scenario'}.essbaseMbrName.toString()
    
    
    Map<String, String> Params = new HashMap<String, String>()
    Params.put('SCENARIO',curscenario)
    Params.put('PARENTENTITY',selectedEntity)
    
     HttpResponse<String> jsonResponse = operation.application.getConnection("JOBS").post()
     .header("Content-Type", "application/json")
     .body(json(["jobType" : "RULES", "jobName" : "ADMIN MEMBER CHANGE","parameters":Params ])).asString()
    
    println jsonResponse.body
     
    

     

     

     

     

    Comment

     

    • Anthony Manfredi

      Brian what I built was a map, so it's easy for you to add additional params without changing the call.  

      Here I added the Scenario as a Second RTP to the parameter map. 

      //Get the Current Parent User Entity from the User Variable
      
      UserVariable UserEntity = operation.application.getUserVariable("TOPENTITY")
      def selectedEntity =UserEntity.getValue().toString()
      
      DataGrid curgrid = operation.getGrid()
      def curscenario=curgrid.pov.find{it.dimName =='Scenario'}.essbaseMbrName.toString()
      
      
      Map<String, String> Params = new HashMap<String, String>()
      Params.put('SCENARIO',curscenario)
      Params.put('PARENTENTITY',selectedEntity)
      
       HttpResponse<String> jsonResponse = operation.application.getConnection("JOBS").post()
       .header("Content-Type", "application/json")
       .body(json(["jobType" : "RULES", "jobName" : "ADMIN MEMBER CHANGE","parameters":Params ])).asString()
      
      println jsonResponse.body
       
      

       

       

       

       

    • Brian M

      Excellent, thanks for the guidance as always.