Does anyone know how to set the maximum and minimum values of a range type
parameter field in code.

The code I have so far is..

* Create the CR Object
LOCAL loCr AS CRAXDRT.APPLICATION
loCr = CREATEOBJECT("CrystalRuntime.Application")

* Open the report
loCrRpt = loCr.OpenReport(ALLTRIM(sp_ReportPath) +
"\"+ALLTRIM(treports.CODE)+STRTRAN(STR(treports.VERSION,3)," ","0")+".rpt")

* Create the Database object
oDB = loCrRpt.Database()

* Get a references to the DatabaseTables collection
ocDbt = oDB.Tables(1)

* set the datasource of the report
FOR EACH cPProperty IN ocDbt.connectionproperties
IF cPProperty.name = "Data Source"
cPProperty.value = gcDataPath
endif
endfor

loCrRpt.DiscardSavedData()


ocParm = loCrRpt.ParameterFields()

oParm = ocParm.GetItemByName("cust")

oParm.SetCurrentValue(lcCustFrom)

oParm.AddCurrentValue(lcCustTo)

This sets the start of the range value but produces an error when the
addcurrentvalue() line runs.

The error says the parameter is not range. I have checked the parametr and
it si a range type parameter. The data type is string.

Thanks in advance
Dave

Re: Crystal reports by Craig

Craig
Thu Dec 02 10:26:58 CST 2004

oParm.MininumValue = 0
oParm.MaximumValue = 100

--
Craig Berntson
MCSD, Visual FoxPro MVP
www.craigberntson.com
Salt Lake City Fox User Group
www.slcfox.org
www.foxcentral.net


<dave> wrote in message news:41af2c85$0$22128$afc38c87@news.easynet.co.uk...
> Does anyone know how to set the maximum and minimum values of a range type
> parameter field in code.
>
> The code I have so far is..
>
> * Create the CR Object
> LOCAL loCr AS CRAXDRT.APPLICATION
> loCr = CREATEOBJECT("CrystalRuntime.Application")
>
> * Open the report
> loCrRpt = loCr.OpenReport(ALLTRIM(sp_ReportPath) +
> "\"+ALLTRIM(treports.CODE)+STRTRAN(STR(treports.VERSION,3),"
> ","0")+".rpt")
>
> * Create the Database object
> oDB = loCrRpt.Database()
>
> * Get a references to the DatabaseTables collection
> ocDbt = oDB.Tables(1)
>
> * set the datasource of the report
> FOR EACH cPProperty IN ocDbt.connectionproperties
> IF cPProperty.name = "Data Source"
> cPProperty.value = gcDataPath
> endif
> endfor
>
> loCrRpt.DiscardSavedData()
>
>
> ocParm = loCrRpt.ParameterFields()
>
> oParm = ocParm.GetItemByName("cust")
>
> oParm.SetCurrentValue(lcCustFrom)
>
> oParm.AddCurrentValue(lcCustTo)
>
> This sets the start of the range value but produces an error when the
> addcurrentvalue() line runs.
>
> The error says the parameter is not range. I have checked the parametr and
> it si a range type parameter. The data type is string.
>
> Thanks in advance
> Dave
>
>
>
>



Re: Crystal reports by dave>

dave>
Fri Dec 03 09:10:15 CST 2004

Thanks for the reply,
I have now come accross another problem.
Using the select expert or record selection formulas is it possible to
select a range of customers using a customer parameter.
If both the lower and upper range values are empty strings then all
customers should be returned.
If the lower is empty then all records up to the upper should be returned
and vice versa.
I also want to be able to say give me all records between a and Z

Thanks in advance
Dave




"Craig Berntson" <iamcraig@iamcraigberntson.com> wrote in message
news:ehPbAvI2EHA.3092@TK2MSFTNGP10.phx.gbl...
> oParm.MininumValue = 0
> oParm.MaximumValue = 100
>
> --
> Craig Berntson
> MCSD, Visual FoxPro MVP
> www.craigberntson.com
> Salt Lake City Fox User Group
> www.slcfox.org
> www.foxcentral.net
>
>
> <dave> wrote in message
news:41af2c85$0$22128$afc38c87@news.easynet.co.uk...
> > Does anyone know how to set the maximum and minimum values of a range
type
> > parameter field in code.
> >
> > The code I have so far is..
> >
> > * Create the CR Object
> > LOCAL loCr AS CRAXDRT.APPLICATION
> > loCr = CREATEOBJECT("CrystalRuntime.Application")
> >
> > * Open the report
> > loCrRpt = loCr.OpenReport(ALLTRIM(sp_ReportPath) +
> > "\"+ALLTRIM(treports.CODE)+STRTRAN(STR(treports.VERSION,3),"
> > ","0")+".rpt")
> >
> > * Create the Database object
> > oDB = loCrRpt.Database()
> >
> > * Get a references to the DatabaseTables collection
> > ocDbt = oDB.Tables(1)
> >
> > * set the datasource of the report
> > FOR EACH cPProperty IN ocDbt.connectionproperties
> > IF cPProperty.name = "Data Source"
> > cPProperty.value = gcDataPath
> > endif
> > endfor
> >
> > loCrRpt.DiscardSavedData()
> >
> >
> > ocParm = loCrRpt.ParameterFields()
> >
> > oParm = ocParm.GetItemByName("cust")
> >
> > oParm.SetCurrentValue(lcCustFrom)
> >
> > oParm.AddCurrentValue(lcCustTo)
> >
> > This sets the start of the range value but produces an error when the
> > addcurrentvalue() line runs.
> >
> > The error says the parameter is not range. I have checked the parametr
and
> > it si a range type parameter. The data type is string.
> >
> > Thanks in advance
> > Dave
> >
> >
> >
> >
>
>



Re: Crystal reports by Craig

Craig
Fri Dec 03 09:33:49 CST 2004

You'll need to write a custom formula to determine what the parameters were.
If the upper one is blank, then the custom formula will create a variable
like "ZZZZZZZZ". Then use the created variables in the SQL statement that's
being passed to access the data.

--
Craig Berntson
MCSD, Visual FoxPro MVP
www.craigberntson.com
Salt Lake City Fox User Group
www.slcfox.org
www.foxcentral.net


<dave> wrote in message news:41b081d8$0$18828$afc38c87@news.easynet.co.uk...
> Thanks for the reply,
> I have now come accross another problem.
> Using the select expert or record selection formulas is it possible to
> select a range of customers using a customer parameter.
> If both the lower and upper range values are empty strings then all
> customers should be returned.
> If the lower is empty then all records up to the upper should be returned
> and vice versa.
> I also want to be able to say give me all records between a and Z
>
> Thanks in advance
> Dave
>
>
>
>