I have a crosstab with three user selectable top groupings and three user selectable left groupings. I am using code to attempt to modify the formatting of the groupings based on the fields the user selects in a set of parameters.
I have the code like this:
var groupingElement = reportContext.getReportRunnable().designHandle.getDesignHandle().findElement("topGrouping1");
updateProperties("dataFormat", groupingElement.getProperty("numberFormat"), "###0{RoundingMode=HALF_DOWN}", "pattern")
groupingElement finds the element in question and updateProperties using a function I wrote to modify the property. This function works perfectly well elsewhere in my report on a dynamically created label that get added to a table:
var agg = elementFactory.newDataItem( null );
.
.
.
if(data_type == "Number") numFormat = updateProperties("dataFormat", agg.getProperty("numberFormat"), fieldInfo[8], "pattern");
.
.
.
When I use it on an existing dataitem (topGrouping1) in the crosstab the object groupingElement.getProperty("numberFormat") is null even though you can see it has the numberFormat property through Eclipse BIRT and I can see it in the cached properties of the dataElement sub-object when I view groupingElement variable in the debugger.
Is this because it exists already and is there anyway to get or alter the property via a different route?
Edit:
Additional Info:
1) updateProperties function
The updateProperties function takes the following arguments:
class: The name of the array of properties allowed
properties object: A properties object
value: This is either a value for the default property or a semi-colon delimited list of property name/value pairs.
default property: The property to use if no property name is specified. (see value above)
This function would to the properties object either set the default property with a single value or if the value is a delimited list work through each one and set all the properties given.
2) I may be able to workround this problem by using the getStyle().property_name method but I would need to write an function that takes the property name and sets the appropriate property. This would be an ineligant way to do this.
[Updated on: Sat, 29 August 2015 11:19]
Report message to a moderator