Jump to content
We've recently updated our Privacy Statement, available here ×

How can I use Cascading Input Controls in the REST PHP API?


jasperUser12

Recommended Posts

Hi,

I can call reports with parameterised input controls from jasperserver in my php without any problems but what I can't figure out how to do is implement cascading input controls properly.

For example, say I have I/P Control A with values of A1, A2 and I/P Control B with values of A1b1 and A1b2 if I/P Control A has A1 selected or values of A2b1 and A2b2 if I/P Control A has A2 selected. I cannot get this to replicate in the php api. I/P Control A will generate with A1 and A2 and I/P Control B will generate with A1b1 and A1b2 (ie the A1 values) but I can't force it to reload to A2b1 and A2b2 if A2 is selected. Has anyone figured this out? I've looked at the Input Control JSON structure and there is a field called "slaveDependencies" but I can't figure out how to take advantage of that. How can I call an input control to regenerate based on the value of its master control?

Thanks in advance!

Link to comment
Share on other sites

  • 2 weeks later...
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

I got it working but I had to write a new function in the wrapper.

public function setCascadingInputControls($uri, $controls, $payload)    {          // $controls is masters;active;slaves/        $url = $this->restUrl2 . '/reports' . $uri . '/inputControls/' . $controls . '/values';        $data = $this->service->prepAndSend($url, array(200), 'POST', $payload, true, 'application/json', 'application/json');        // Can use the InputControl createFromJSON() function as structure is the same.        //print($data);        return InputControl::createFromJSON($data);    }[/code]
  1. The $controls object has to be defined as follows : "masterDependencies;currentControlSelected;slaveDependencies"
  2. The $payload object has to be an array of objects with the key as the control id and the value as (a possible array of) the selected option(s).
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...