[Logo] SpagoWorld Forums
  [Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Members]  Member Listing  
[Groups] Back to home page  [Moderation Log] Moderation Log   [Register] Register /  [Login] Login 
Passing parameters using the SpagobiSDK the Javascript SDK  XML
Forum Index » Technical Help - SpagoBI SDK
Author Message
vijitc@gmail.com .spw



Joined: 27/03/2015 09:45:25
Messages: 6
Offline

I have the Javascript SDK working just fine, but I cannot figure out how to pass a parameter. I used one of the SpagoBI examples to try it out but it does not work. Here is a code snippet.

---
execTest2 = function() {
var html = Sbi.sdk.api.getDocumentHtml({
documentLabel: '<%= documentLabel %>'
, executionRole: '/spagobi/admin'
, parameters: {par_cbuno: <%= cbuno %>}
, displayToolbar: true
, displaySliders: false
, iframe: {
height: '100%'
, width: '100%'
, style: 'border: 0px;'
}
});
document.getElementById('targetDiv').innerHTML = html;
};
--------
cbuno is a java jsp variable.
My SpagoBI chart has an analytical driver whose URL is named par_cbuno. It is set as a 'string manual input'. When I run the chart directly from SpagoBI, I am prompted for the string. However, when I set the parameter in the SDK (as shown above), The chart still prompts me for a string value and it appears the parameter I passed is ignored.

Any ideas how I should properly do this please?

This message was edited 1 time. Last update was at 05/06/2015 13:07:52

vijitc@gmail.com .spw



Joined: 27/03/2015 09:45:25
Messages: 6
Offline

UPDATE: I was doing my testing using the javascript I built using the ant build provided. It combines the javascript into a single JavaScript called sbisdk-all-debug.js (I just did an 'ant create-debug' from the js folder)

When I include this JS in my JSP and set a parameter like this:

parameters: {par_cbuno: <%= cbuno %>}

It appears to ignore any parameters I send

However, when I used the sbisdk-all-production.js, the parameters worked and the Document is rendered against the parameter I sent.
But interestingly if I leave the Parameter out, I get prompted for it, but just as a Textbox, rather than the way I have set it up as a radio button list. That radio button list shows properly though if I use sbisdk-all-debug.js

So I wonder if the source javascript that comes with the SDK is up to date?

Has anyone else experienced this. You can easily try it with one of the example.jsp programs. Use example1.jsp and put in one of the document labels of one of the charts with parameters and you will see what I mean if you switch the
sbisdk-all-production.js with sbisdk-all-debug.js

I am using the latest 5.1 release from January 2015

This message was edited 2 times. Last update was at 08/06/2015 14:47:58

vijitc@gmail.com .spw



Joined: 27/03/2015 09:45:25
Messages: 6
Offline

Well I suppose everyone is busy. I looked at the source for the JavaScript files, but I am almost convinced they do not match what makes up
js/sbisdk-all-production.js

If someone from Spago can send the actual js source and the up to date build to build the js, we can look into finding the issue in the code and we can send back the fixes. I suppose we have to go through the proper channels for that.

In the mean time, I guess we will have to use the TAG library till I hear something. Sigh!

mahamunicm.spw



Joined: 25/01/2017 10:30:04
Messages: 7
Offline

vijitc@gmail.com .spw wrote:
However, when I used the sbisdk-all-production.js, the parameters worked and the Document is rendered against the parameter I sent.

How did you resolve this issue? I am also using "sbisdk-all-production.js" but parameters I am passing are getting ignored.
This is my code:

Can you help me with this?
mmaarriioo.spw



Joined: 20/04/2017 18:43:52
Messages: 3
Offline

I have same problem. I can't pass parameters. Any suggestions?
mahamunicm.spw



Joined: 25/01/2017 10:30:04
Messages: 7
Offline

mmaarriioo.spw wrote:I have same problem. I can't pass parameters. Any suggestions?


I could not find any solution for this issue. We used other workaround for that. We made provision to save document label in in our database and loaded that particular document in iframe (we created document in spago as per requirement).
mmaarriioo.spw



Joined: 20/04/2017 18:43:52
Messages: 3
Offline

I solved my problem.
I was wrong to pass the parameter.

The parameter must be written

parameters: {'PARAMETERS': 'par_clientId=1'}

and not

parameters: {par_clientId: 3}

I try with a text parameter and it works fine too!

mahamunicm.spw



Joined: 25/01/2017 10:30:04
Messages: 7
Offline

@mmaarriioo.spw : Thanks for solution. I will try it out whenever possible and let you know. I hope this works for me as well
 
Forum Index » Technical Help - SpagoBI SDK
Go to:   
Powered by JForum 2.1.9 © JForum Team