Dan Soares
Dan Soares

Reputation: 380

XPages and EL concat

I am trying to implement the example at http://lpar.ath0.com/2014/04/07/repeated-xpages-input-controls-with-number-indexed-field-names/

I've got it working. This is the call to the composite control:

<xc:track_row row="#{rownum}" fieldName="Track#{rownum}" dataSource="#{document1}" />

However, what I'd like is to save fields with the 01, 02 concatenated instead of 1, 2 etc. I've tried

fieldName="Track#{(rownum lt 10)? '0'.concat(rownum):rownum}" 

However that generates an EL syntax error on that line. What am I doing wrong?

Thanks,

Dan

Upvotes: 0

Views: 287

Answers (1)

Sven Hasselbach
Sven Hasselbach

Reputation: 10485

You can use multiple EL statements, it is a String only. All EL notations will be replaced during processing of the expressions. You can solve it this way:

fieldName="Track#{(rownum lt 10)? '0':''}#{rownum}" 

Upvotes: 3

Related Questions