Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Please help:encapsulating a field in a text objec Post Reply Post New Topic
Author Message
giansi
Newbie
Newbie


Joined: 10 Feb 2009
Location: Italy
Online Status: Offline
Posts: 2
Quote giansi Replybullet Topic: Please help:encapsulating a field in a text objec
     Posted: 10 Feb 2009 at 3:37am
Hi all!
I need your help to resolve my problem:
I use VB6 and Crystal reports 9, with CRAXDDRT component.
I made a report with a text field called Text1 on report header, and its content is "LIST OF PRODUCTS".
Now I should change that text: it should become "LIST OF PRODUCTS FROM " {@StartDate} TO {@EndDate}, where StartDate and EndDate are  parameters o functions, or database fields (parameters in this case).
No problem, obviously, using crystal reports software, but I should make this changing using VB6 and CRAXDDRT..
I tried in this way:
 CrxSection.AddTextObject("LIST OF PRODUCTS FROM " + CrxReport.ParameterFields.Item(1). Name + " TO " + CrxReport.ParameterFields.Item(2). Name
 
..But while I expected something like "LIST OF PRODUCTS FROM 1/1/2009 TO 1/31/2009", the result is: "LIST OF PRODUCTS FROM " {@StartDate} TO {@EndDate} Cry
 
 
How can I do to embed the parameter in that text field?
I think that for formulas and db field I should use the same method..
 
Thanks for your help.
Luca (Italy)
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 10 Feb 2009 at 8:44am

I haven't done this, but looking at the code and the results, you don't want the Name, you probably want something like ToString or Value. (I can't remember VB6 anymore).

Hope this helps.
IP IP Logged
giansi
Newbie
Newbie


Joined: 10 Feb 2009
Location: Italy
Online Status: Offline
Posts: 2
Quote giansi Replybullet Posted: 10 Feb 2009 at 8:59am
Thanks for your answer.
I don't need a value indeed..
I should build a new report with the new text instead of the old one.. my vb6 app should automatically do what I'd do working on the .rpt file directly, but I don't want to do so for about 50 prints (I must change the text for everyone!Cry), so my small application should make the "dirty job" for me...
I need that the report "recognizes" the parameters as parameters, and not as part of a string...
I hope to be clear with my poor english..
Luca 
IP IP Logged
Handsome-Hal
Newbie
Newbie
Avatar

Joined: 06 Feb 2009
Location: United States
Online Status: Offline
Posts: 7
Quote Handsome-Hal Replybullet Posted: 10 Feb 2009 at 12:51pm
You may wish to test and see if you are actually passing the Parameter to the report correctly first before putting it in a text field. Just place the parameter field on the form somewhere and see if it is populated.

If it does get passed correctly...then your concatenation is incorrect within the text box.

If it doesn't...then try something like this within VB6:

crxReport.ParameterFields.GetItemByName(Item(1).strName).AddCurrentValue (Item(1).varValue)

Hal
IP IP Logged
Katrien
Newbie
Newbie


Joined: 02 Mar 2009
Location: Belgium
Online Status: Offline
Posts: 2
Quote Katrien Replybullet Posted: 02 Mar 2009 at 4:56am
I have exactly the same problem. But in my case I want to translate the hard-coded text in another language end the parameter fields or database fields between {} must stay the same.
 
Datum: {Datum afdruk} {Tijd afdruk} 
Date: {Datum afdruk} {Tijd afdruk}
 
So I thougt to get the Text (we use Visual Dataflex, but what can be done in VB can we do in Visual Dataflex) and then translate the stuff that isn't between the {}. But after setting the translated string, Crystal interprets the whole string as a text and doesn't replace what was original the date and time.
 
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum