MVBasic and %query

1 view
Skip to first unread message

tomh

unread,
Nov 11, 2009, 10:35:06 AM11/11/09
to InterSystems: MV Community
Hi,

Apologies in advance, I'm doing this from memory...

I'm attempting to populate a cell of a tablepane, by using
( cloning? ) the 'oncallack' methods described in the <column>
documentation.

However, I am using MVBasic, instead of cache basic, as in the
documentation.

Everything seems to actually work OK, except I am unable to retrieve
the value of the column using MVBasic in the callback method.

Is there a 'substitute' in MVBasic for the function "%query(var)".

Or, will I need to figure out a different way to obtain this value in
the oncallback method?

Thank you,

Tom H

Ed Clark

unread,
Nov 11, 2009, 10:38:21 AM11/11/09
to intersy...@googlegroups.com
What emulation (use the CEMU command to see) are you using?
> --
> You received this message because you are subscribed to the Google
> Groups "InterSystems: MV Community" group.
> To post to this group, send email to Cac...@googlegroups.com
> To unsubscribe from this group, send email to CacheMV-u...@googlegroups.com
> For more options, visit this group at http://groups.google.com/group/CacheMV?hl=en

tomh

unread,
Nov 11, 2009, 10:55:09 AM11/11/09
to InterSystems: MV Community
I'm in Zen, perhaps I posted to the wrong group?

But, as I recall, CEMU returns cache, ( or whatever the default is ).

Thanks,

Tom H

Ed Clark

unread,
Nov 11, 2009, 11:00:11 AM11/11/09
to intersy...@googlegroups.com
yep, you should probably post to the zen group.
If you were using CEMU D3, it would potentially have explained the
problem.
%query(var) isn't a function: %query is a multidimensional array
variable. It should work fine in multivalue basic unless you are using
CEMU D3.

tomh

unread,
Nov 12, 2009, 5:06:18 AM11/12/09
to InterSystems: MV Community


Hi,

I will try this a different way. Again, this is in Zen. I post here in
the hopes that an mv developer will know how to convert this.

From the documentation, I have created an callback method, to override
a cell in a tablepane

The column:
<column colName="Status" header="UnPost" OnDrawCell="DrawYesNo"
seed="Posted"/>

The method:
Method DrawYesNo(pTable As %ZEN.Component.tablePane, pName As %String,
pSeed As %String) As %Status [ Language = cache ]
{

If %query(pName) = pSeed {
Write "Posted"
} Else {
Write ""
}
Quit $$$OK
}

This works great. However, I need to know how to convert this to
mvbasic, specifically the "%query(pName)", which returns the value of
the cell I desire to over-ride.

Any Ideas?

Thanks,

Tom H

Ed Clark

unread,
Nov 12, 2009, 8:02:58 AM11/12/09
to intersy...@googlegroups.com
Change the "Language=" to mvbasic. Change the WRITEs to CRT. WRITE
doesn't automatically add a return, so use a colon on the CRTs. You
can't use macros in mvbasic, but the equivalent of $$$OK is 1. Any
variable that begins with % (like %query) is a special variable that
acts similarly to an mvbasic named common variable (but without the
need for a COMMON declaration):

Method DrawYesNo(pTable As %ZEN.Component.tablePane, pName As %String,
pSeed As %String) As %Status [ Language = mvbasic ]
{

If %query(pName) = pSeed then
crt "Posted":
end Else
crt "":
end
return 1

tomh

unread,
Nov 12, 2009, 9:19:58 AM11/12/09
to InterSystems: MV Community
Thanks Ed,

I will look into this further this evening.

Tom H

tomh

unread,
Nov 13, 2009, 6:12:16 AM11/13/09
to InterSystems: MV Community
Thanks Ed,

This works.

Method DrawYesNo(pTable As %ZEN.Component.tablePane, pName As %String,
pSeed As %String) As %Status
{

dim %query()

If %query(pName) = pSeed then
print "Posted"
end else
print ""
end
return 1
}

Reply all
Reply to author
Forward
0 new messages