| Author |
Message |
hilfy
Admin Group
Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
|

Posted: 18 Mar 2009 at 10:31am |
You could look at using a parameter -
1. Create the parameter on the main report.
2. The easiest way I know of to get the param into the subreport is to create a dummy link on it then go to the Select Expert in the subreport and delete the condition that uses the param. You'll now have a param that is linked to the param on the main report.
3. Use the parameter instead of a text box. Or, if you want a default value in case the parameter is empty, create a formula and use that.
Good luck!
-Dell
|
|
|
IP Logged |
|
|
|
shortduck
Newbie
Joined: 17 Mar 2009
Online Status: Offline
Posts: 13
|

Posted: 20 Mar 2009 at 6:07am |
Thanks Dell
for this.
U know, my team member tried having a parameter on the report, but somehow he always used to get a blank report. So I thought that this is again some weired bug, so i dropped the idea of having a parameter.
then I tried this yerterday and it worked !! i dont know Y it did not worked on his report.
Anyways, its working well on my reports and this is the code that I have used.
rptClientDoc.DataDefController.ParameterFieldController.SetCurrentValue("", "txtProviderName", "some Text");
I dont understand wht can't Crystal have something as simple as this for the TextBoxes also.
anyways this is woking for me and I am happy,
Many thanks for all the advice and your time.
duck
|
IP Logged |
|
shortduck
Newbie
Joined: 17 Mar 2009
Online Status: Offline
Posts: 13
|

Posted: 20 Mar 2009 at 6:08am |
For everyone else having the same issue, I did not used any subreport.link as Dell suggested. I just added a standard paramenter and it worked for me.
Edited by shortduck - 20 Mar 2009 at 6:09am
|
IP Logged |
|
lockwelle
Moderator
Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
|

Posted: 20 Mar 2009 at 6:21am |
I was going to suggest a parameter, or in my case I use ADO.Net to get the data, so I just create a column in a table (I always have one called params) that would have the value. So if you are using stored procs or XML you can add in what you need, and just report on it.
|
IP Logged |
|
underdog
Newbie
Joined: 29 Jul 2009
Location: United States
Online Status: Offline
Posts: 1
|

Posted: 29 Jul 2009 at 6:23pm |
I am new enough to Crystal that I am not comfortable with parameters yet (though they are probably quite easy and the way to go as you have outlined above). So, I trudged down the road of using the object model.
This code snippet works (but I concur that this seems like overload):
final ReportObjectController c = oReportClientDocument.getReportDefController().getReportObjectController();
final IReportObject ro = oReportClientDocument.getReportDocument().getReportDefinition().findObjectByName("txtReportOptions");
log.debug(ro == null);
if (ro instanceof ITextObject) {
final TextObject orig = (TextObject)ro;
final TextObject copy = (TextObject)orig.clone(true);
final IParagraphElement elem = copy.getParagraphs().getParagraph(0).getParagraphElements().getParagraphElement(0);
if (elem instanceof IParagraphTextElement) {
final IParagraphTextElement updated = (IParagraphTextElement)elem;
log.debug(updated.getText());
updated.setText("new-text-goes-here");
}
c.modify(orig, copy);
} Edited by underdog - 29 Jul 2009 at 6:26pm
|
|
The reverse side has a reverse side.
|
IP Logged |
|
lockwelle
Moderator
Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
|

Posted: 30 Jul 2009 at 12:14pm |
if you are doing that much coding, just 'create' the data that you want and include it in the dataset...then write a formula for Crystal to access.
parameters are in crystal 101...you can't do much with Crystal without them...time to learn.
|
IP Logged |
|
shortduck
Newbie
Joined: 17 Mar 2009
Online Status: Offline
Posts: 13
|

Posted: 03 Mar 2010 at 12:42pm |
|
Hi,
Sorry for the late reply, but now I am using
rptClientDoc.DataDefController.ParameterFieldController.SetCurrentValue("", "txtTopText3New", "Text here");
and it works!!
|
IP Logged |
|
shortduck
Newbie
Joined: 17 Mar 2009
Online Status: Offline
Posts: 13
|

Posted: 04 Mar 2010 at 6:24am |
|
I am using this now, to set the value of the textbox:
rptClientDoc.DataDefController.ParameterFieldController.SetCurrentValue("", "txtCare", "text here");
|
IP Logged |
|
|
|