Home
Analytics
AutoText value
offspring
Hi,
I use an autoText and i whish have the value of my autoText.
Does it's possible ?
Thanks
Find more posts tagged with
Comments
mwilliams
Hi offspring,
Can you explain a little further? Thanks.
offspring
Hi,
I use AutoText to include the numbering of my pages. Everything works but I want to retrieve the number of each page.
thank you
mwilliams
offspring,
Within the report, you can grab the current page number with the variable 'pageNumber'.
Not sure if that's what you're looking for though...let me know if that helps.
offspring
i use this code :
AutoTextHandle autoTextPage = design.getElementFactory().newAutoText("Pages");
autoTextPage.setProperty(AutoText.AUTOTEXT_TYPE_PROP, "page-number");
autoTextPage.setProperty(StyleHandle.FONT_SIZE_PROP, "12");
on all my pages I have the page number displayed, but I want to retrieve this value in a variable
Can you help me please ?
Thanks
mwilliams
offspring,
pageNumber is the variable name that you can grab the page number you're currently on from. Can you explain what you're trying to do by getting the page number? Maybe I can help more then.
offspring
Hi
I want to create a summary.
The idea is to retrieve the page number containing chauqe page title.
I have to like her because BIRT handle pagination, and content to my other page number is different
Thank you
offspring
Hi
I used this :
design.getProperty("numberPage")
but the result = 0
Same with design.getIntProperty("numberPage")
Can you help me ?
thanks
mwilliams
offspring,
In a quick test, I was able to grab the page numbers of different items in the report by setting them to PGV's and recalling them later.
reportContext.setPersistentGlobalVariable("item_name1", pageNumber.toString());
Then was able to recall it later with reportContext.getPersistentGlobalVariable("item_name1);
This is one way to go about grabbing the page number to do a summary at the end of your report.
offspring
Hi mwilliams
I test and I will say you
Else thanks you very much for your help
offspring
Hi
I have an probleme
this is my code :
AutoTextHandle autoTextPage = design.getElementFactory().newAutoText(
"Pages");
autoTextPage.setProperty(AutoText.AUTOTEXT_TYPE_PROP, "page-number");
IReportContext reportContext = null;
reportContext.setPersistentGlobalVariable ("item_name1", autoTextPage.toString() );
But I have a java null pointer exception
Could you tell me how you use a reportContext? (initialisation)
Thanks
mwilliams
offspring,
I'm calling the reportContext call in the onCreate script of the element that I want to find the page number of. Then, I use a dynamic text box in the report to call the PGVs using the other reportContext call.
offspring
Hi mwilliams
I'm sorry but do you have an example ?, because I don't find.
I don't find to create the function OnCreate()
In attach file, I have my code to generate a report
Can you help me ?
Thanks
offspring
Hi
For example, this is the code an SummaryPage :
private void getSommaire(CellHandle cell, int idRevClient,
ReportDesignHandle design) throws SemanticException, IOException {
LabelHandle lblSommaire = efactory.newLabel("sommaire");
//System.out.println("Page : "+reportContext.getPersistentGlobalVariable("page-number"));
lblSommaire.setText("Sommaire");
lblSommaire.setProperty(FONT_FAMILY, ARIAL);
lblSommaire.setProperty(FONT_SIZE, "14");
lblSommaire.setProperty(TEXT_ALIGN, CENTER);
cell.getContent().add(lblSommaire);
}
I want have this number Page,
but How to get the reportContext ?
cell.getOnCreate() return an string
Can you help me ?
Thanks
offspring
Hi
To have onCreate, do you add an Listener ?
if not, i tried an DynamicTextEventAdapter but I have always errors.
Thanks
mwilliams
offspring,<br />
<br />
onCreate is a script method that is built into BIRT. In the designer, you can click on any element, go to the script tab, and choose onCreate from the drop down. In java code, you'd just need to call the onCreate method for the report element that you're working with.<br />
<br />
Here is a post in the devShare that might help. It has a download with a powerpoint that goes over the different scripting methods in BIRT and also comes with examples of using java and javascript.<br />
<br />
<a class='bbc_url' href='
http://www.birt-exchange.com/devshare/designing-birt-reports/339-birt-advanced-report-and-chart-scripting-examples/#description'>BIRT
Advanced Report and Chart Scripting Examples - Designs & Code - BIRT Exchange</a>
offspring
Hello,
Sorry for the question but how do you call the method for OnCreate () of an element?
Thanks
mwilliams
offspring,
If you download the file from the link I posted above, there are .java files in the "reports" zip file that's in there that show code for overriding the script methods in your report. They should help.
jbenson304
Whew - a long winded thread. Thanks for the answer to this error. I was having a similar problem myself and was glad someone else addressed it.
mwilliams
Hi jbenson304,
No problem. That's what we're here for. Let us know whenever you have questions!
kosta
Hello BIRT community, <br />
<br />
the <br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
reportContext.setPersistentGlobalVariable ("item_name1", autoTextPage.toString() );
reportContext.getPersistentGlobalVariable("item_name1");
</pre>
<br />
solution is good for making list with page number as mwilliams mentioned before.<br />
<br />
I have tried to show the variable in the render method of some dummy text item before the set-method is invoked hoping that this outcome I can use to create table of content. But the "getPersistentGlobalVariable" returns null.<br />
<br />
Has anyone some idea how this data can be shown at the beginning of the report?<br />
<br />
Thanks in advance.
mwilliams
Kosta,
You could duplicate your report and hide it the first time through. Then, you could figure out the page numbers in the hidden section, show your page numbers list, then display the results.