Passing Text to Crystal Report 
Author Message
 Passing Text to Crystal Report

You can do this, but you have to set the value of a formula,


You would set the value of the formula to be "USER NAME"

this willl print out the raw text. I always use the API calls and not
the OCX, so I can't remember off the top of my head if the OCX has
this in it or not.



Quote:
>Can I pass a piece of text to a Crystal Report.

>For example,

>I use the Crystal custom control and can pass some selection criteria.
>I also need to pass the user name of the current logged on user so that
>I can print it at the top of the report.

>My user name isn't stored within the database so the only way I could do it
>is to
>somehow pass it as a variable

>Any ideas ??

>Thanks
>--
>Knight Computer Systems Ltd

ANTI SPAM - Please delete the # before my email in order to send me a responce.

http://www.*-*-*.com/

Fraser



Thu, 27 Apr 2000 03:00:00 GMT  
 Passing Text to Crystal Report

Can I pass a piece of text to a Crystal report.

For example,

I use the Crystal custom control and can pass some selection criteria.
I also need to pass the user name of the current logged on user so that
I can print it at the top of the report.

My user name isn't stored within the database so the only way I could do it
is to
somehow pass it as a variable

Any ideas ??

Thanks
--
Knight Computer Systems Ltd



Thu, 27 Apr 2000 03:00:00 GMT  
 Passing Text to Crystal Report

An additional example,
You can define a blank formula "USER" in your Report. Blank means for
example the empty string ''. You can overwrite any formulas with the
formulas-'collection' of your CrystalReports-Control starting with
parameter 0, followed by 1 and so forth.

With CrystalReports1
        .Formulas(0) = "USER='My name is jack'"               ' String
        .Formulas(1) = "BEGIN=DATE(1997,12,31)"               ' Date                  .Formulas(2) =
"SUPRESSDETAIL=True"          ' Bool
        .print
end with

Don't forget to reset the .formulas(..) with the empty string before you
reuse the control for another Report that doesn't contain the specified
formulafields. Otherwise you'll receive a runtime error.

hope it'll help

following s
If you defined a formula named "USER" in your Report you can set a new
value

Quote:


> >Can I pass a piece of text to a Crystal report.

> >For example,

> >I use the Crystal custom control and can pass some selection criteria.
> >I also need to pass the user name of the current logged on user so that
> >I can print it at the top of the report.

> >My user name isn't stored within the database so the only way I could do it
> >is to
> >somehow pass it as a variable

> >Any ideas ??

> >Thanks
> >--
> >Knight Computer Systems Ltd



Thu, 27 Apr 2000 03:00:00 GMT  
 Passing Text to Crystal Report

Yes, there are more than one ways to pass a string:
1- You can define a parameter which data type is string.  Then set this
parameter value from your VB code.I use this method and it works good. Here
is a sample code :

 Dim value As PEValueInfo
 Dim paramInfo As PEParameterFieldInfo
 Dim UserNameStr as String

 paramInfo.StructSize = Len(paramInfo)
 value.StructSize = Len(value)

 UserNameStr="JOE"

 value.valueType = PE_PF_STRING
 value.viString = UserNameStr & Chr$(0)

 If PEConvertVInfoToPFInfo(value, value.valueType, paramInfo.CurrentValue)
= 0 Then
    MsgBox Str$(PEGetErrorCode(printJob))
 End If

 If PESetNthParameterField(printJob, i, paramInfo) = 0 Then
  MsgBox Str$(PEGetErrorCode(printJob))
 End If

PS. This code uses Print Engine Calls in order to run a Crystal Report File



Fri, 28 Apr 2000 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Passing Parameters from C# to Crystal Report / Crystal Report Viewer

2. How to pass VB5 values to Crystal Report text field

3. How to pass VB5 values to Crystal Report text field

4. How do I pass text box value to crystal report

5. Passing text from C# to Crystal Report

6. How to dynamically pass a text string into crystal reports

7. Crystal Reports - Report Title Passing

8. Q: Pass a SQL query from VB to crystal report sub-report

9. Passing parameters to a report in Crystal Reports 6

10. Crystal reports 9 -report in text format

11. Printing Crystal Reports without Crystal Control ActiveX or Crystal Reports API call

12. HOW TO: Pass text box values as a parameter to Crystal 7

 

 
Powered by phpBB® Forum Software