Syntax for a list param

 

cirrusimaging's picture

What is the proper way to send a list as a parameter to OpenRPT Renderer:

-param=some_id:list[1,2,3] ????

I can't seem to find much documentation on this, maybe I'm not looking hard enough.

Thanks,

Shawn

cirrusimaging's picture
Offline
Joined: 03/17/2009
bump Anyone??

bump

Anyone??

gmoskowitz's picture
Offline
Joined: 12/10/2008
Re: Syntax for a list param

Shawn,

From C++ you should be able to create a QVariantList of values and assign it to the parameter, something like:

QVariantList alist;
alist.append(QVariant("zeroth"));
alist.append(QVariant("first"));

ParameterList params;
params.append("list1", alist);

From JavaScript you should be able to create an array and assign it to the parameter, something like:

var params = new Object();
params.list1 = new Array();
params.list1[0] = "zeroth";
params.list1[1] = "first";
// or
params.list2 = [ 0, 1 ];

The Qt docs on converting between script and C++ types might be helpful.

Gil

cirrusimaging's picture
Offline
Joined: 03/17/2009
Thanks for the reply

Gil,

I was actually looking for an example of a list parameter through a command line run time switch. I guess I should have been more clear in my original post. Although I'm sure I'll use your examples somewhere :-). I'm trying to send a list parameter to a report through PHP if that helps.

Is it something like:

/path/to/openrpt/rptrender -databaseURL=psql://localhost/mydb:5666 -param=some_id:list[1,2,3]

Thanks,

Shawn

gmoskowitz's picture
Offline
Joined: 12/10/2008
Passing a list to the report

Passing a list to the report renderer on the command line? That explains the odd syntax in your initial post :-) There doesn't appear to be any code in the command line parser to do this.

Please enter an issue. This is an interesting hole in functionality.

Gil

cirrusimaging's picture
Offline
Joined: 03/17/2009
Got the answer...

In case anyone needs it here is how you send a list of integers (thanks cryan):

-param=some_id:QVariantList=int:0,int:1,int:2,int:3

Shawn