From: Bill Tillick on
Hello again,
I have a SQLServer (VO2.8) attached to a bBrowser3. The server
contains a CategoryCode that I now 'translate' into a CategoryName by
using a codeblock to lookup the CategoryCode in a reference table.
This is now working fine.

I separately use a CaptionClick method to reorder the rows according
to which Caption was clicked. I use the Event from the click to
determine which column was clicked by examining the
oEvent:column:FieldSym and then send an appropriate OrderBy to the
server.
This worked fine UNTIL I changed the Category column from ..ID
to ..Name by using the aforementioned CodeBlock. I first thought that
the solution would be to assign a Hyperlabel when I create the column
- but that didn't work??

So, my question is, how can I detect that the Category caption was
clicked (without resorting to using the column number which could
change in the future)?

Thanks,
Bill
--------------------------------

Relevant code is:
(a) creating the column
oColumn := bDataColumn{ self:oDCbBrowse, self:server, {|s,oWin|
oWin:GetCatName() }, #EXPRESSION, self}
oColumn:Hyperlabel := HyperLabel{#CategoryName}

(b) testing the CaptionClick
DO CASE
CASE oEvent:column:FieldSym == #ProductID
self:Server:OrderBy(#ProductID )

CASE oEvent:column:FieldSym == #ProductName
self:server:OrderBy( #ProductName )

CASE oEvent:column:FieldSym == #ProductDescription
self:server:OrderBy( #ProductDescription )

CASE oEvent:column:FieldSym == #CategoryName (This used to be
#CategoryID)
self:server:OrderBy( #CategoryName )

CASE oEvent:column:FieldSym == #ManufacturerID
self:server:OrderBy( #ManufacturerID )

CASE oEvent:column:FieldSym == #ProductPrice
self:server:OrderBy( #ProductPrice )
ENDCASE

From: Geoff Schaller on
So why doesn't this work?

"Bill Tillick" <wtillick(a)gmail.com> wrote in message
news:75154f5f-ddf2-4395-8c3c-93c6c5d15538(a)y32g2000prc.googlegroups.com:

> Hello again,
> I have a SQLServer (VO2.8) attached to a bBrowser3. The server
> contains a CategoryCode that I now 'translate' into a CategoryName by
> using a codeblock to lookup the CategoryCode in a reference table.
> This is now working fine.
>
> I separately use a CaptionClick method to reorder the rows according
> to which Caption was clicked. I use the Event from the click to
> determine which column was clicked by examining the
> oEvent:column:FieldSym and then send an appropriate OrderBy to the
> server.
> This worked fine UNTIL I changed the Category column from ..ID
> to ..Name by using the aforementioned CodeBlock. I first thought that
> the solution would be to assign a Hyperlabel when I create the column
> - but that didn't work??
>
> So, my question is, how can I detect that the Category caption was
> clicked (without resorting to using the column number which could
> change in the future)?
>
> Thanks,
> Bill
> --------------------------------
>
> Relevant code is:
> (a) creating the column
> oColumn := bDataColumn{ self:oDCbBrowse, self:server, {|s,oWin|
> oWin:GetCatName() }, #EXPRESSION, self}
> oColumn:Hyperlabel := HyperLabel{#CategoryName}
>
> (b) testing the CaptionClick
> DO CASE
> CASE oEvent:column:FieldSym == #ProductID
> self:Server:OrderBy(#ProductID )
>
> CASE oEvent:column:FieldSym == #ProductName
> self:server:OrderBy( #ProductName )
>
> CASE oEvent:column:FieldSym == #ProductDescription
> self:server:OrderBy( #ProductDescription )
>
> CASE oEvent:column:FieldSym == #CategoryName (This used to be
> #CategoryID)
> self:server:OrderBy( #CategoryName )
>
> CASE oEvent:column:FieldSym == #ManufacturerID
> self:server:OrderBy( #ManufacturerID )
>
> CASE oEvent:column:FieldSym == #ProductPrice
> self:server:OrderBy( #ProductPrice )
> ENDCASE

From: BillT on
Hey, Geoff, that's MY question!!
From: Roger Lawton on
Bill:

Not sure if this is your problem but since you changed the column CategoryID
to CategoryName by using an expression, this column is not a "real" column
in the server. Therefore it cannot sort by that column.

We use VO2Ado servers in our system and we have similar situations. If I
want to sort by a description of something (which like you is stored in
another table) I do an inner join when I do the select and then it is a
"real" column in the server and can be sorted.

HTH


--
Roger Lawton
Product Manager
SOMAX, Inc.


"Bill Tillick" <wtillick(a)gmail.com> wrote in message
news:75154f5f-ddf2-4395-8c3c-93c6c5d15538(a)y32g2000prc.googlegroups.com...
> Hello again,
> I have a SQLServer (VO2.8) attached to a bBrowser3. The server
> contains a CategoryCode that I now 'translate' into a CategoryName by
> using a codeblock to lookup the CategoryCode in a reference table.
> This is now working fine.
>
> I separately use a CaptionClick method to reorder the rows according
> to which Caption was clicked. I use the Event from the click to
> determine which column was clicked by examining the
> oEvent:column:FieldSym and then send an appropriate OrderBy to the
> server.
> This worked fine UNTIL I changed the Category column from ..ID
> to ..Name by using the aforementioned CodeBlock. I first thought that
> the solution would be to assign a Hyperlabel when I create the column
> - but that didn't work??
>
> So, my question is, how can I detect that the Category caption was
> clicked (without resorting to using the column number which could
> change in the future)?
>
> Thanks,
> Bill
> --------------------------------
>
> Relevant code is:
> (a) creating the column
> oColumn := bDataColumn{ self:oDCbBrowse, self:server, {|s,oWin|
> oWin:GetCatName() }, #EXPRESSION, self}
> oColumn:Hyperlabel := HyperLabel{#CategoryName}
>
> (b) testing the CaptionClick
> DO CASE
> CASE oEvent:column:FieldSym == #ProductID
> self:Server:OrderBy(#ProductID )
>
> CASE oEvent:column:FieldSym == #ProductName
> self:server:OrderBy( #ProductName )
>
> CASE oEvent:column:FieldSym == #ProductDescription
> self:server:OrderBy( #ProductDescription )
>
> CASE oEvent:column:FieldSym == #CategoryName (This used to be
> #CategoryID)
> self:server:OrderBy( #CategoryName )
>
> CASE oEvent:column:FieldSym == #ManufacturerID
> self:server:OrderBy( #ManufacturerID )
>
> CASE oEvent:column:FieldSym == #ProductPrice
> self:server:OrderBy( #ProductPrice )
> ENDCASE
>

From: Geoff Schaller on
Bill,

You aren't showing us any useful code. You just gave a description and
from the description, I would expect the process to work.

SHOW US THE CODE <g>.

I don't know how often we have to ask for this. Put simply - you stuffed
something up. I can't tell where until I see the code but I suspect it
is in the column detection part and this is the part you haven't shown
us. Everything else looks just fine.

Geoff

PS - this process will work whether it is a "real" column or a
calculated one.

"BillT" <wtillick(a)hotmail.com> wrote in message
news:1d5111d9-171a-42a0-a6ee-0ee993c36d33(a)o14g2000pri.googlegroups.com:

> Hey, Geoff, that's MY question!!