Absent Member.
Absent Member.

[archive] Crystal I did my homework

[Migrated content. Thread originally posted on 31 March 2003]

I find this vb demo to have a parameters i need some help to translate to cobol...

So far i did that

77 hx-crreport handle of Report.
77 hx-crapp handle of Application.
77 hx-PARAMDEFS handle of ParameterFieldDefinitions.
77 hx-PARAMDEF handle of ParameterFieldDefinition.
77 hx-viewer handle of CRViewer9.
77 ws-fileid pic x(256)

create @Application of @CRAXDRT handle is hx-crapp.
modify hx-crapp @OpenReport (ws-fileid)
returning hx-crreport.


Here is the bugs i don't now what i have to put a modify or inquire
inquire hx-crreport @ParameterFields::hx-Paramdefs.

MODIFY hx-crreport @PrintOut(0).

destroy hx-crreport.
destroy hx-crapp.

Public Sub myreports()
Const RptFile = "\Crystal\MyReport.rpt"
dim crApp as new CRAXDRT.Application
Dim crRepp As CRAXDRT.Report
Dim crParamDefs As CRAXDRT.ParameterFieldDefinitions
Dim crParamDef As CRAXDRT.ParameterFieldDefinition
Dim crDBTab As CRAXDRT.DatabaseTable

' Open report file
Set crRepp = crApp.OpenReport(App.Path & RptFile)
' Set location of database based on WhatCompany
crRepp.Database.LogOnServer "p2ssql.dll", "Server Name", "DB Name", "User ID", "Password"
' Set table location to appropriate company server
For Each crDBTab In crRepp.Database.Tables
crDBTab.SetLogOnInfo "Server Name", "DB Name", "User ID", "Password"
crRepp.DisplayProgressDialog = True
' Fill report parameters
Set crParamDefs = crRepp.ParameterFields
For Each crParamDef In crParamDefs
Select Case crParamDef.ParameterFieldName
Case "Parameter1"
crParamDef.SetCurrentValue ("Parameter 1 Value")
crParamDef.SetCurrentValue DateValue("01/01/1980")
crParamDef.SetCurrentValue DateValue("12/31/1980")
End Select
crRepp.EnableParameterPrompting = False
' Display it for the user to print or export
crViewer1.ReportSource = crRepp
End Sub
2 Replies
Absent Member.
Absent Member.

RE: [archive] Crystal I did my homework

Good work!

I suppose this should do the trick:

77 ws-index pic 9(4).
77 ws-count pic 9(4).
77 ws-name pic x(64).
Inquire hx-crreport ParameterFields IN hx-paramdefs.
Inquire hx-paramdefs Count IN ws-count.
perform varying ws-index from 1 by 1 until ws-index > 1
inquire hx-paramdefs Item(ws-index) in hx-paramdef
inquire hx-paramdef ParameterFieldName IN ws-name
Evaluate TRUE
WHEN ws-name = "Parameter1"
modify hx-paramdef SetCurrentValue("Parameter 1 Value")
WHEN ws-name = "@STARTDATE"
modify hx-paramdef SetCurrentValue("01/01/1980")
WHEN ws-name = "@ENDDATE"
modify hx-paramdef SetCurrentValue("12/31/1980")
Absent Member.
Absent Member.

RE: [archive] Crystal I did my homework

I am trying to use a multiply cie.
The name of the file for the customer is 01ARCLI.001 for cie 1 and 02ARCLI.001 for the cie 2

IN the odbc i name CIE-01 for my data of 01ARCLI.001 and
CIE-02 for my data of 02ARCLI.001

And i want the same report just to change the database so far i try without success

Inquire hx-crreport Database IN hx-database.
Inquire hx-DATABASE Tables in hx-databases.
inquire hx-DATABASES Item(1) in WS-NAME.
Inquire hx-database Parent IN ws-name.
Inquire hx-database DictionaryLocation IN ws-name.

I am searching the name of database that his used for the report.
and the way to change it.
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.