MV Base class query

1 view
Skip to first unread message

Jason Warner

unread,
Oct 27, 2009, 3:52:51 PM10/27/09
to InterSy...@googlegroups.com
I am trying to put together a generic interface to MV data that I can
use to give me a %ResultSet. I seem to remember Lee or Rich writing some
code that would allow just that. However, I can't seem to find it
anywhere. I am fairly sure that I didn't dream this up, but I could be
wrong. Is there a way to generate a %ResultSet from an MV query?

I looked at creating a class query, but the ROWSPEC parameter that would
give me back some really useful data is set at compile time. Is there a
way to set the information sent back from ROWSPEC at runtime?

A potential solution would be to create a class that behaved in the
manner that I would like. For example, MyMvResultSet would have a place
to feed it the query that would execute and generate a list of keys. I
would then have a property where I would specify the attributes that I'm
interested in and the column header to give that attribute.

That all seems very doable, but I want to make sure that I'm not
reinventing the wheel by doing this.

Jason

Lee Burstein

unread,
Oct 27, 2009, 5:10:14 PM10/27/09
to InterSy...@googlegroups.com, Jason Warner
I’ve attached two classes as an export. These come from the DeepSee/MultiValue Tutorial DVD. Both return the same result, one is an SQL query and the other is a custom query coded in MVBasic. This can serve as a starting point. Let me know if you need an explanation of what I did and why.


Lee Burstein
Product Manager
InterSystems Corporation
Office: 302-477-0180
Cell: 302-345-0810

Queries.xml

Jason Warner

unread,
Oct 27, 2009, 5:27:11 PM10/27/09
to InterSy...@googlegroups.com
Lee,

Thanks for the code. It makes me feel better knowing I didn't dream this up. However, how can I create a more generalized query that doesn't have a ROWSPEC defined? I want to be able to define the ROWSPEC when the person sets up the query rather than when the class is compiled.

Jason

André

unread,
Oct 28, 2009, 10:14:12 AM10/28/09
to InterSy...@googlegroups.com

I've worked with MV and this will help us so much. However, is it possible to define criteria for the query?

If it is possible, what should I do to pass parameters and how could I call the query that I created passing parameters?

Thanks.
2009/10/27 Jason Warner <jas...@brashers.com>

Andre Luis - Shift

unread,
Oct 29, 2009, 9:00:27 AM10/29/09
to InterSystems: MV Community

I found out a solution. We could use the resultSet object and pass the
parameter at the execute comand.
See the example:
Set result = ##Class(%resultSet).%New()
Set result.ClassName = "Classname"
Set result.QueryName = "QueryName"
Set sc = result.execute("parameter")

We have used it with tablePane in our zenPage and it worked well.

Thanks.
> > Cell: 302-345-0810- Ocultar texto das mensagens anteriores -
>
> - Mostrar texto das mensagens anteriores -
Reply all
Reply to author
Forward
0 new messages