You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "Hensley, Richard" <Ri...@McKesson.com> on 2004/06/29 20:06:03 UTC

Expression in columns property question

I want to use an expression in a column that includes a comma and can't for
the life of me figure out how to do it.

My first cut was the following:
  	<table jwcid='@contrib:FormTable' 
    		source="ognl:patients"
    		value="ognl:currentPatient"
    		columns='Name:lastName + ", " +
firstName,Birthdate:dateOfBirth' />

It doesn't work because the columns property is split using a comma. This
makes a very unhappy Ognl parser... :)

My next attempt was 
  	<table jwcid='@contrib:FormTable' 
    		source="ognl:patients"
    		value="ognl:currentPatient"
    		columns='Name:lastName + "&#044; " +
firstName,Birthdate:dateOfBirth' />

Which renders very nicely as

Hensley&#044 Richard

Not very pretty, but getting closer.

My next attempt was 

  	<table jwcid='@contrib:FormTable' 
    		source="ognl:patients"
    		value="ognl:currentPatient"
    		columns='Name:lastName + comma +
firstName,Birthdate:dateOfBirth' />

With the following in the page specification

  <property name="comma" value=", " />

But that rendered nothing, and gave me the following in the log.

Cannot use column expression 'lastName + comma + firstName' in row

Anybody got any suggestions? 

I really thought the comma property was the ticket, but I don't think I'm
understanding the Ognl rendering context well enough yet.

I will keep playing with it.

Richard


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Expression in columns property question

Posted by Holger Stephan <ho...@frogleg.net>.
I 'cheated' in this case and just added another getter getFullName for
that business object and assembled the name there, together with a
comma. 

- Holger

On Wed, 2004-06-30 at 01:11, Srinivasan Ranganathan wrote:
> Hensley, Richard wrote:
> 
> >I want to use an expression in a column that includes a comma and can't for
> >the life of me figure out how to do it.
> >...


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Expression in columns property question

Posted by Srinivasan Ranganathan <sr...@mailforce.net>.
Hensley, Richard wrote:

>I want to use an expression in a column that includes a comma and can't for
>the life of me figure out how to do it.
>
>My first cut was the following:
>  	<table jwcid='@contrib:FormTable' 
>    		source="ognl:patients"
>    		value="ognl:currentPatient"
>    		columns='Name:lastName + ", " +
>firstName,Birthdate:dateOfBirth' />
>
>It doesn't work because the columns property is split using a comma. This
>makes a very unhappy Ognl parser... :)
>
>My next attempt was 
>  	<table jwcid='@contrib:FormTable' 
>    		source="ognl:patients"
>    		value="ognl:currentPatient"
>    		columns='Name:lastName + "&#044; " +
>firstName,Birthdate:dateOfBirth' />
>
>Which renders very nicely as
>
>Hensley&#044 Richard
>
>Not very pretty, but getting closer.
>
>My next attempt was 
>
>  	<table jwcid='@contrib:FormTable' 
>    		source="ognl:patients"
>    		value="ognl:currentPatient"
>    		columns='Name:lastName + comma +
>firstName,Birthdate:dateOfBirth' />
>
>With the following in the page specification
>
>  <property name="comma" value=", " />
>
>But that rendered nothing, and gave me the following in the log.
>
>Cannot use column expression 'lastName + comma + firstName' in row
>
>Anybody got any suggestions? 
>
>I really thought the comma property was the ticket, but I don't think I'm
>understanding the Ognl rendering context well enough yet.
>
>I will keep playing with it.
>
>Richard
>
>  
>
This is what I do

<span jwcid="@Conditional" condition="ognl:paymentsMade">
    <table jwcid="table@Contrib:Table" class="results" 
style="margin-left: auto; margin-right: auto;"
        source="ognl:results"
        columns="amount:Payment Amount:amount, from:From:payment.from, 
to:To:payment.to"
    />
    <span jwcid="amountColumnValue@Block"><div align="right"><span 
jwcid="@Insert" value="ognl:components.table.tableRow.amount" 
format="ognl:myFormat"/></div></span>
</span>

Replace the Insert value with what you want, in this case, "firstname, 
lastname". I'd be interested if there's a better way to do this.

Regards
Srini


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org