Home > Archive > dBASE Bugs > November 2006 > OLH: params









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author OLH: params
Roger Sauer

2006-11-14, 7:18 pm

Parameters passed to a report.

Property of

ReportViewer

Description

The params property contains an associative array that contains parameter names and values, if any, that are passed to the specified .REP file. The parameters are passed in the order they are assigned to the params property.

====================
=============

My tests show that the elements in the associative array are passed to the .REP file in *reverse* order from which they were added to the array.

Roger
Bruce Beacham

2006-11-14, 7:18 pm

Roger Sauer wrote:

> The params property contains an associative array that contains
> parameter names and values, if any, that are passed to the specified
> .REP file. The parameters are passed in the order they are assigned
> to the params property.
>
> ====================
=============
>
> My tests show that the elements in the associative array are passed
> to the .REP file in *reverse* order from which they were added to the
> array.


Since it's an assoc array I'm surprised they're passed in _any_ coherent
order!

From the OLH on assocarray class: "The order of elements in an
associative array is undefined. "

It sounds like the description is muddled as if params started as a
regular array and then was developed into an assocarray.


Bruce Beacham
Ken Mayer [dBVIPS]

2006-11-14, 7:18 pm

Roger Sauer wrote:
> Parameters passed to a report.
>
> Property of
>
> ReportViewer
>
> Description
>
> The params property contains an associative array that contains parameter names and values, if any, that are passed to the specified .REP file. The parameters are passed in the order they are assigned to the params property.
>
> ====================
=============
>
> My tests show that the elements in the associative array are passed to the .REP file in *reverse* order from which they were added to the array.


In general, an associative array sort of ignores any sequence you might
imagine. You're lucky if you can count on the sequence always being in
reverse, frankly. I've seen the sequence be quite a jumble ...

Ken

--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/

*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/dbase/dBASEBook.htm
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase
Roger Sauer

2006-11-15, 7:32 pm

Ah. I was passing an AssocArray to ReportViewer.wfm and using a count() loop in ReportViewer to load the params property. I can see now that that would produce an unreliable param-list order.

Should have just passed an array, rather than an assocArray.

Thanks, Ken & Bruce.

Roger

Ken Mayer [dBVIPS] Wrote:

> Roger Sauer wrote:
>
> In general, an associative array sort of ignores any sequence you might
> imagine. You're lucky if you can count on the sequence always being in
> reverse, frankly. I've seen the sequence be quite a jumble ...
>
> Ken
>
> --
> /(Opinions expressed are purely my own, not those of dataBased
> Intelligence, Inc.)/
>
> *Ken Mayer* [dBVIPS]
> /Golden Stag Productions/
> dBASE at goldenstag dot net
> http://www.goldenstag.net/dbase/dBASEBook.htm
> http://www.goldenstag.net/GSP
> http://www.goldenstag.net/dbase


Ken Mayer [dBVIPS]

2006-11-15, 7:32 pm

Roger Sauer wrote:
> Ah. I was passing an AssocArray to ReportViewer.wfm and using a count() loop in ReportViewer to load the params property. I can see now that that would produce an unreliable param-list order.
>
> Should have just passed an array, rather than an assocArray.


Well, it's an Associative Array, the index is whatever you gave it, so:

if form.params.isKey( "MyIndex" )
// do something
else
msgbox( "MyIndex not passed as parameter", "Programmer Error", 16 )
return
endif

Or something like that.

Ken

--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/

*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/dbase/dBASEBook.htm
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase
Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com