You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Klaus Bertram <be...@n-bis.de> on 2001/09/17 20:05:35 UTC
RE: programatically examine columns in a row
Hi Chris,
try it with <esql:get-columns/>
like these
<esql:row-results>
<esql:get-columns/>
</esql:row-results>
the result in xsp is like these:
<colname1>value</colname1><colname2>value</colname2>...
at your xsl you can separate it for colname and value
Klaus
> -----Original Message-----
> From: Chris Newland [mailto:chris.newland@emorphia.com]
> Sent: Monday, September 17, 2001 8:43 PM
> To: cocoon-users@xml.apache.org
> Subject: programatically examine columns in a row
>
>
> Hi All,
>
> I'm looking for a generic way to examine the columns in a row
> retrieved using esql:
>
> <esql:results>
> <xsp:logic>
> int cols = <esql:get-column-count/>;
> String colname;
> </xsp:logic>
>
> <esql:row-results>
> <xsp:logic>
> for (int i = 0; i < cols; i++)
> {
> colname =
> <esql:get-column-name><xsp:attribute
> name="column"><xsp:expr>i</xsp:expr></xsp:attribute></esql:get-col
> umn-name>;
>
> }
> </xsp:logic>
> </esql:row-results>
> </esql:results>
>
> but this throws an exception: No method matching getColumnName()
> found in interface java.sql.ResultSetMetaData. (i.e. the column
> attribute is not being picked up)
>
> Is it possible to add attributes to a logicsheet tag? I don't
> think it is but I can't think of another way of passing the
> parameter to the get-column-name tag.
>
> Is this possible?
>
> Thanks,
>
> Best Regards,
>
> Chris
>
>
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
>
> To unsubscribe, e-mail: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
Re: programatically examine columns in a row
Posted by Chris Newland <ch...@emorphia.com>.
Hi Klaus
Realised this is not sensible thing to do so I passed the whole result set to
the stylesheet and used XSL to filter the output.
Thanks for the suggestion,
Chris
On Monday 17 September 2001 19:06, Chris Newland wrote:
> Hi Klaus,
>
> Sorry, I should have explained it better. I want to examine the column
> values and only produce XML for column names that have a certain value.
>
> Each row in my table has columns of type bool and I want to only display
> the names of columns where the value is 1 (true).
>
> Do you know of a way to do this?
>
> Thanks,
>
> Chris
>
> On Monday 17 September 2001 18:05, Klaus Bertram wrote:
> > Hi Chris,
> >
> > try it with <esql:get-columns/>
> >
> > like these
> > <esql:row-results>
> > <esql:get-columns/>
> > </esql:row-results>
> >
> > the result in xsp is like these:
> >
> > <colname1>value</colname1><colname2>value</colname2>...
> > at your xsl you can separate it for colname and value
> >
> > Klaus
> >
> > > -----Original Message-----
> > > From: Chris Newland [mailto:chris.newland@emorphia.com]
> > > Sent: Monday, September 17, 2001 8:43 PM
> > > To: cocoon-users@xml.apache.org
> > > Subject: programatically examine columns in a row
> > >
> > >
> > > Hi All,
> > >
> > > I'm looking for a generic way to examine the columns in a row
> > > retrieved using esql:
> > >
> > > <esql:results>
> > > <xsp:logic>
> > > int cols = <esql:get-column-count/>;
> > > String colname;
> > > </xsp:logic>
> > >
> > > <esql:row-results>
> > > <xsp:logic>
> > > for (int i = 0; i < cols; i++)
> > > {
> > > colname =
> > > <esql:get-column-name><xsp:attribute
> > > name="column"><xsp:expr>i</xsp:expr></xsp:attribute></esql:get-col
> > > umn-name>;
> > >
> > > }
> > > </xsp:logic>
> > > </esql:row-results>
> > > </esql:results>
> > >
> > > but this throws an exception: No method matching getColumnName()
> > > found in interface java.sql.ResultSetMetaData. (i.e. the column
> > > attribute is not being picked up)
> > >
> > > Is it possible to add attributes to a logicsheet tag? I don't
> > > think it is but I can't think of another way of passing the
> > > parameter to the get-column-name tag.
> > >
> > > Is this possible?
> > >
> > > Thanks,
> > >
> > > Best Regards,
> > >
> > > Chris
> > >
> > >
> > > ---------------------------------------------------------------------
> > > Please check that your question has not already been answered in the
> > > FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
> > >
> > > To unsubscribe, e-mail: <co...@xml.apache.org>
> > > For additional commands, e-mail: <co...@xml.apache.org>
>
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
>
> To unsubscribe, e-mail: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
Re: programatically examine columns in a row
Posted by Chris Newland <ch...@emorphia.com>.
Hi Klaus,
Sorry, I should have explained it better. I want to examine the column values
and only produce XML for column names that have a certain value.
Each row in my table has columns of type bool and I want to only display the
names of columns where the value is 1 (true).
Do you know of a way to do this?
Thanks,
Chris
On Monday 17 September 2001 18:05, Klaus Bertram wrote:
> Hi Chris,
>
> try it with <esql:get-columns/>
>
> like these
> <esql:row-results>
> <esql:get-columns/>
> </esql:row-results>
>
> the result in xsp is like these:
>
> <colname1>value</colname1><colname2>value</colname2>...
> at your xsl you can separate it for colname and value
>
> Klaus
>
> > -----Original Message-----
> > From: Chris Newland [mailto:chris.newland@emorphia.com]
> > Sent: Monday, September 17, 2001 8:43 PM
> > To: cocoon-users@xml.apache.org
> > Subject: programatically examine columns in a row
> >
> >
> > Hi All,
> >
> > I'm looking for a generic way to examine the columns in a row
> > retrieved using esql:
> >
> > <esql:results>
> > <xsp:logic>
> > int cols = <esql:get-column-count/>;
> > String colname;
> > </xsp:logic>
> >
> > <esql:row-results>
> > <xsp:logic>
> > for (int i = 0; i < cols; i++)
> > {
> > colname =
> > <esql:get-column-name><xsp:attribute
> > name="column"><xsp:expr>i</xsp:expr></xsp:attribute></esql:get-col
> > umn-name>;
> >
> > }
> > </xsp:logic>
> > </esql:row-results>
> > </esql:results>
> >
> > but this throws an exception: No method matching getColumnName()
> > found in interface java.sql.ResultSetMetaData. (i.e. the column
> > attribute is not being picked up)
> >
> > Is it possible to add attributes to a logicsheet tag? I don't
> > think it is but I can't think of another way of passing the
> > parameter to the get-column-name tag.
> >
> > Is this possible?
> >
> > Thanks,
> >
> > Best Regards,
> >
> > Chris
> >
> >
> > ---------------------------------------------------------------------
> > Please check that your question has not already been answered in the
> > FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
> >
> > To unsubscribe, e-mail: <co...@xml.apache.org>
> > For additional commands, e-mail: <co...@xml.apache.org>
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>