on ‎2009 Dec 16 6:28 PM
Hi all,
I am trying to reference an object on my report which contains a Formula field.
I have read the following 2 threads, but they refer to textObjects:
[How do you reference a textObject on a Crystal report using Java|]
[Changing the text of ITextObject programatically|]
But I cannot even get those to work. I can reference a object which refers to a database field but as soon as I try
reference a textObject or reportObject I just get a NULL variable.
Below is the code I am useing
IReportObject dbField = reportClientDocument.getReportDefController().findObjectByName("BOB1");
IReportObject textBob = reportClientDocument.getReportDefController().findObjectByName("BOB2");
"BOB1" is the name of my DB field Object, and "BOB2" can be a Text box or a Formula item and I just get nothing.
I have just tested it with a FieldHeadingObject and that returns a valid object, so clearly I am going about this the wrong way
for objects I place on the reports which are not driven by the database items.
Ultimately what I want to do is reference an object in the Report Footer which will contain the RecordCount of the number of
records contained in the report, which I am them going to use to determine if the report holds data,
if it does I will print it, else ignore it and move on the the next report. I am doing this so that I can at an extra filter to split
a report up into groups and produce a sinlge PDF for each group instead of one massive PDF containing all the groups.
So if someone has a solution to any of my problems I would be very greatful, and I dont mind being told Im an idiot and should
rather do it another way, as long as you supply that other way
Thanks for the help
Darren
Edited by: Darren Jackson on Dec 16, 2009 7:29 PM
Forgot to add am using CR4Ev2 SP3
Request clarification before answering.
Right I have made some headway.
Firstly, Im an idiot. I was making changes and setting up test fields on my report, but then when running the app, I had it looking at
the backup report, which would explain why all the new textbox fields were not being found.
The stupiditity did force me to delve deep and work out a fair bit of how the reports work, so cant complain too much. BUT, I am still
not able to return values of Formula fields and formulas extra. Could someone tell me if this is even possible. I get retrieve the formula field
name, and properties but not its value once the report has been populated. Am I wasting my time?
Well I will continue dismantling my reports till I find the answer, or someone points me in the right direction.
If any one is interested this is the code I used to drill down to my text boxes:
IReportObject recCount = reportClientDocument.getReportDefController().findObjectByName("TB1");
ITextObject obj_RecCount = (ITextObject) recCount;
System.out.println(obj_RecCount.getName());
Paragraphs objP = obj_RecCount.getParagraphs();
for (int i = 0; i < objP.size(); i++){
ParagraphElements pE = objP.getParagraph(i).getParagraphElements();
for (int j = 0;j < pE.size(); j++){
IParagraphTextElement pEE = (ParagraphTextElement) pE.getParagraphElement(j);
System.out.println(pEE.getText());
}
}
Cheers
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 9 | |
| 4 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.