Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Variable interval for Page Break
Jay1238
Hello,<br />
In a crosstab i am able to put the page break interval for my columns.<br />
<br />
<extended-item extensionName="LevelView" name="NewLevel View11" id="1541"><br />
<property name="level">HWF_A1_Zone/ZoneCode</property><br />
<property name="pageBreakBefore">auto</property><br />
<property name="pageBreakAfter">auto</property><br />
<property name="member"><br />
<br />
<strong class='bbc'><property name="pageBreakInterval">7</property></strong><br />
<br />
How do i make it variable (and not fixed like 7 in this case) based on some global variable?<br />
<br />
Thanks,<br />
Jay
Find more posts tagged with
Comments
kclark
Could you post the rptdesign for me? Are you wanting the user to determine the page break? I think you should just be able to pass the parameter to your code.
Jay1238
Thanks for the response. Basically, i will be parsing this line from my xml data
<RequestKey>INTLRS_1800644_en_US_KG_EPUS</RequestKey>
I am thinking i can store the parse value in a global variable and use it here. Just not sure how.
If the last two is US then page break is 7, if IN then page break is 4 so on and so forth.
Thanks,
Jay
kclark
Checkout <a class='bbc_url' href='
http://www.birt-exchange.org/org/devshare/designing-birt-reports/197-parse-xml-from-database-field-in-birt-report/'>this
devshare</a>, you can grab the data from RequestKey with something similar shown it that.<br />
<br />
After you've got the data what I would do is grab the string length of it, then read the last two line of the string and you could do something like<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
importPackage(Packages.org.apache.xerces.parsers);
importPackage(Packages.org.xml.sax);
importPackage(Packages.java.io);
var parser = new DOMParser();
parser.parse(new InputSource(new StringReader(dataSetRow["/*ROWNAME*/"])));
var nodelist = parser.getDocument().getElementsByTagName('RequestKey');
var parsedData = nodelist.item(0).getFirstChild().getNodeValue();
if(parsedData=="US") {
// Code to change page break
reportContext.setPersistentGlobalVariable("grouping","7")
}else if(pasedData=="IN") {
// More code
reportContext.setPersistentGlobalVariable("grouping","4")
}
</pre>
Jay1238
Thanks kclark!
kclark
No problem! Did it work for you?
Jay1238
Hi kclark,
I am having the same issue as my datasource in different post. i am not able to call getGlobalVariable in xml element tag.
For instance,
reportContext.setGlobalVariable("break",4)
<property name="pageBreakInterval">reportContext.getGlobalVariable("break")</property>
Please let me know if this is right way to call.
Thanks,
Jay
Jay1238
Hi kclark,
Where in my crosstab script should i do setExtensionProperty("pageBreakInterval", somevalue)?
Thanks - Jay
kclark
Jay,<br />
You'd put the pagebreak in beforeFactory()<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
columnLevels.get(0).setIntProperty("pageBreakInterval", 1);
</pre>
<br />
I've attached a sample report.