In http://www.craigberntson.com/Articles/kb014.htm, section "parameters
fields".

* Get the Special Message Parameter
ocParm = oRpt.ParameterFields()
oParm = ocParm.Item(1)
oParm.SetCurrentValue("This is the runtime special message")

How was the parameter field "Item(1)" created in CR? A regular text
object? Is there a way to address the field by name (something like
Item["name"])?

--
.~. Might, Courage, Vision. Sincerity. http://www.linux-sxs.org
/ v \
/( _ )\ (Fedora Core 4) Linux 2.6.14-1.1644_FC4
^ ^ 14:11:01 up 6 days 1:47 load average: 0.03 0.03 0.00

RE: [crystal report] passing parameter from VFP to CR by MichelRoy

MichelRoy
Tue Dec 06 05:07:02 CST 2005

the parameterfields is a collection but from the example i saw
in vb they did not add a name on creation.

you can get the parameter field name with
ocParm.Item(1).ParameterFieldName

"man-wai chang" wrote:

> In http://www.craigberntson.com/Articles/kb014.htm, section "parameters
> fields".
>
> * Get the Special Message Parameter
> ocParm = oRpt.ParameterFields()
> oParm = ocParm.Item(1)
> oParm.SetCurrentValue("This is the runtime special message")
>
> How was the parameter field "Item(1)" created in CR? A regular text
> object? Is there a way to address the field by name (something like
> Item["name"])?
>
> --
> .~. Might, Courage, Vision. Sincerity. http://www.linux-sxs.org
> / v \
> /( _ )\ (Fedora Core 4) Linux 2.6.14-1.1644_FC4
> ^ ^ 14:11:01 up 6 days 1:47 load average: 0.03 0.03 0.00
>

Re: [crystal report] passing parameter from VFP to CR by Man-wai

Man-wai
Tue Dec 06 05:41:55 CST 2005

Michel Roy wrote:
> the parameterfields is a collection but from the example i saw
> in vb they did not add a name on creation.
>
> you can get the parameter field name with
> ocParm.Item(1).ParameterFieldName

Thans. Got it working, with the example from Mr. Bernston's site. I
could only reference them as 1,2,3,4,5... How does CR set the order of
parameter field? I meant is it a trial-and-error process to find out the
order from VFP side?

--
.~. Might, Courage, Vision. Sincerity. http://www.linux-sxs.org
/ v \
/( _ )\ (Ubuntu 5.10) Linux 2.6.14.3
^ ^ 19:40:02 up 9 days 23:34 load average: 1.85 1.46 1.48

Re: [crystal report] passing parameter from VFP to CR by Dan

Dan
Tue Dec 06 15:03:01 CST 2005

Crystal uses collections, you can interate through them to get the names. I
wrote a routine awhile back to read a crystal report and display its
information into my standard toolbox program.

The code was similar to the following:

cFileName = "D:\Acoworks\Dev\Acowin_Source\Reports\CallSlip.rpt"

? Read_CR(cFileName)

PROCEDURE Read_CR
LPARAMETERS cFileName

IF FILE(cFileName)=.f.
MESSAGEBOX("File not found")
RETURN
ENDIF


oCR = CREATEOBJECT("CrystalRuntime.Application")
oRpt = oCR.OpenReport(cFileName)

m_text = ""
crlf = CHR(13)+CHR(10)

m_section_count = oRpt.Sections.Count
FOR m_cnt1 = 1 to m_section_count
oSection = oRpt.Sections.Item(m_cnt1)
m_obj_count = oSection.ReportObjects.count

m_text = m_text + REPLICATE('=',100) + crlf
m_text = m_text + "Section: " + oSection.Name + crlf

FOR m_cnt2 = 1 to m_obj_count
oObject = oSection.ReportObjects.Item(m_cnt2)
clName = oObject.Name

m_text = m_text + "Object: " + PADR(ALLTRIM(STR(m_cnt2)),10) +
PADR(ALLTRIM(clName),20)

do case
case left(upper(clName),4)="TEXT"
m_text = m_text + oObject.text
case left(upper(clName),4)="SUB"
m_text = m_text + oObject.SubReportName
case left(upper(clName),4)="FIEL"
m_text = m_text + oObject.Field.Name
ENDCASE

m_text = m_text + crlf

ENDFOR

m_text = m_text + crlf

ENDFOR

RETURN m_text

ENDPROC



This output is a bit crude, but you can format the information into a nice
user interface.

Hope this helps,
Dan









"Man-wai Chang" <toylet.toylet@gmail.com> wrote in message
news:%23PceLol%23FHA.2300@TK2MSFTNGP10.phx.gbl...
> Michel Roy wrote:
> > the parameterfields is a collection but from the example i saw
> > in vb they did not add a name on creation.
> >
> > you can get the parameter field name with
> > ocParm.Item(1).ParameterFieldName
>
> Thans. Got it working, with the example from Mr. Bernston's site. I
> could only reference them as 1,2,3,4,5... How does CR set the order of
> parameter field? I meant is it a trial-and-error process to find out the
> order from VFP side?
>
> --
> .~. Might, Courage, Vision. Sincerity. http://www.linux-sxs.org
> / v \
> /( _ )\ (Ubuntu 5.10) Linux 2.6.14.3
> ^ ^ 19:40:02 up 9 days 23:34 load average: 1.85 1.46 1.48



Re: [crystal report] passing parameter from VFP to CR by man-wai

man-wai
Tue Dec 06 18:55:47 CST 2005

Thank you very much!

--
.~. Might, Courage, Vision. Sincerity. http://www.linux-sxs.org
/ v \
/( _ )\ (Fedora Core 4) Linux 2.6.14-1.1644_FC4
^ ^ 08:55:01 up 6 days 20:31 load average: 0.00 0.00 0.01

Re: [crystal report] passing parameter from VFP to CR by Cy

Cy
Sat Dec 17 17:35:17 CST 2005

Man-wai Chang wrote:
> Michel Roy wrote:
>
>> the parameterfields is a collection but from the example i saw
>> in vb they did not add a name on creation.
>>
>> you can get the parameter field name with
>> ocParm.Item(1).ParameterFieldName
>
>
> Thans. Got it working, with the example from Mr. Bernston's site. I
> could only reference them as 1,2,3,4,5... How does CR set the order of
> parameter field? I meant is it a trial-and-error process to find out the
> order from VFP side?
>
If nothing else, the number of the parameter in the collection matches
the order is shows in the parameter screen in Crystal Reports.

Re: [crystal report] passing parameter from VFP to CR by Man-wai

Man-wai
Sun Dec 18 08:18:01 CST 2005

> If nothing else, the number of the parameter in the collection matches
> the order is shows in the parameter screen in Crystal Reports.

Thanks.

--
.~. Might, Courage, Vision. SINCERITY. http://www.linux-sxs.org
/ v \
/( _ )\ (Ubuntu 5.10) Linux 2.6.14.4
^ ^ 22:17:01 up 1 day 23:30 load average: 0.03 0.03 0.00