on 09-11-2008 9:13 AM
Hello,
I would like to set default values of paramter field.
I can acces default values of an existing rpt file with code.
But I don't know how to set it.
I looked examples on business object web site, I found example for setting "current values" but I did not find example for setting default values.
Could you give me some examples?
Thank you
In RAS 9, any report modification fell under the RCAPI umbrella, and you were required to purchase an RCAPI license in order to use those functions. Originally the ability to change table location fell under the RCAPI scope - but this was later patched so that you could change table location without needing an RCAPI license.
Unfortunately, what is happening here is that you are trying to modify the parameter object, which does fall under the RCAPI license - so there will not be any patch to fix this error.
Your only options unfortunately are to either upgrade to a newer version which doesn't have this restriction on RCAPI licensing, to edit the default values through the report designer, or to obtain an RCAPI license for version 9 and then add it using the keycode manager.
Regards,
Shawn
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Values newDefaultValues = new Values();
// use the following link for help on Values class that has multiple add methods to populate Values field.
ParameterField pf = new ParameterField();
pf.setDefaultValues(newDefaultValues);
reportClientDocument.getdataDefCntroller().getParameterFieldController().modify(<index on this parameter, index is 0 based>, pf);
// You can also use the overloaded modify method.
In short you create a new ParameterField object identical to the one your report has and add new Default Values and then call modify method to replace existing parameter with the newly created one.
reportClientDocument.save();
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jessy,
Here is a sample code snippet of how to set the default values for a parameter:
/********************************************************************************************
* Setting the default parameter values
********************************************************************************************/
DataDefController crDataDefController = crReportClientDocument.getDataDefController();
IDataDefinition crDataDefinition = crDataDefController.getDataDefinition();
Fields crFields = crDataDefinition.getParameterFields();
ParameterField crParameterField_StringParam_old = (ParameterField) crFields.get(0);
ParameterField crParameterField_StringParam_new = (ParameterField) crParameterField_StringParam_old.clone(true);
Values crValues_StringParam = new Values();
crValues_StringParam.add("Default String Param 1");
crValues_StringParam.add("Default String Param 2");
crParameterField_StringParam_new.setDefaultValues(crValues_StringParam);
ParameterFieldController crParameterFieldController = crReportClientDocument.getDataDefController().getParameterFieldController();
crParameterFieldController.modify(crParameterField_StringParam_old, crParameterField_StringParam_new);
Hope this helps.
Regards,
Dan
What version are you using? Would it be 9, 10 or XI?
I think in older versions, you'd wrap the value in either ParameterFieldDiscreteValue or ParameterFieldRangeValue class instance:
IParameterFieldDiscreteValue pfdv = new ParameterFieldDiscreteValue();
pfdv.setValue(stringValue);
parameterField.getCurrentValues().add(pfdv);
and equivalent for default values.
Sincerely,
Ted Ueda
Now, I have an exception on the following line:
crParameterFieldController.modify(crParameterField_StringParam_old, crParameterField_StringParam_new);
Here is the exception:
"You are not licensed to use the Report Application Server's report creation API." ... "Code error 266247".
I had the same exception with setTableLocation() method. I applied patch sp7 and it solved the problem. Do you know why I have this exception again?
Thank You.
RAS 9 has a plethora of different licensing - with various different functionalities enabled depending on whether you had standard, professional, developer, advanced developer, or one of the many OEM versions.
The exception indicates you have a version with no ability to set the table location.
Regrets,
Ted Ueda
Hi,
Thanks for thatclarification. With JRC SDKs the specific functionality is not available. You can use Inproc or unmanaged RAS and you will be able to access the default values of a parameter in a report. To be able to use unmanaged RAS, you need concurrent Enterprise\CR server license( for Guest Logon).
Thanks
Aasavari
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
If the report is Enterprise managed then you can retrieve the default values using getDefaultValues() method on IReportParameter. It returns IReportParameterValues collection of default values. Please refer to the link below for description of getDefaultValues().
You mentioned that you are able to access the current values, is it using the same interface? are you using unmanaged reports ( reports that are not published to BO enterprise, but just on your server)?
Thanks
Aasavari
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.