I have to do some thing like
<if-not-empty field="parameters.disableForYear"> <set-calendar field="disabledDateTime" from-field="nowTimeStamp" years="${parameters.disableForYear}"/> <else> <set-calendar field="disabledDateTime" from-field="nowTimeStamp" years="20"/> </else> </if-not-empty> I was wondering if above code could be replaced by some thing (using default-value or value attribute) <set-calendar field="disabledDateTime" from-field="nowTimeStamp" years="${parameters.disableForYear}" default-value="20"/> But doing so I am getting an exception. What is the way to perform this operation in <set-calender> tag. Would appreciate any pointers. Thanks, Vikas |
Sorry, I was just asking about default-value attribute behavior in
<set-calender> - Vikas On Mon, Sep 1, 2008 at 5:38 PM, Vikas Mayur <[hidden email]> wrote: > I have to do some thing like > > <if-not-empty field="parameters.disableForYear"> > <set-calendar field="disabledDateTime" from-field="nowTimeStamp" > years="${parameters.disableForYear}"/> > <else> > <set-calendar field="disabledDateTime" from-field="nowTimeStamp" > years="20"/> > </else> > </if-not-empty> > > I was wondering if above code could be replaced by some thing (using > default-value or value attribute) > <set-calendar field="disabledDateTime" from-field="nowTimeStamp" > years="${parameters.disableForYear}" default-value="20"/> > > But doing so I am getting an exception. > What is the way to perform this operation in <set-calender> tag. > > Would appreciate any pointers. > > Thanks, > Vikas > |
Vikas,
The default value is used if from-field is null instead of setting the default value for the years. Here are the details from XSD file :- <xs:element name="set-calendar" substitutionGroup="OtherOperations"> <xs:annotation> <xs:documentation> The set-calendar tag allows to set a date "field" from another "from-field" date field type or directly from a value using at least one adjuster to modify the from-field date. The type of fields or value is Timestamp. Again you can use the flexible string expander here, the ${} syntax and such. It can also do a type conversion, so going from whatever type the source data is in, which would be a string value or whatever the variable type is for a from field, it can convert that to any ofthese types before setting it in the target field. You can also specify a default value in the case that the value evaluates to an empty string or the from-field is null or empty. Then the default-value will be used. Adjuster years, months, days, hours, minutes, seconds and millis use integers optionally precedeed by + or - Period-align-start and period-align-end allows to align on end or start of a period. You may specify a locale or a time-zone else the respective default request value is used. </xs:documentation> </xs:annotation> <xs:complexType> <xs:attributeGroup ref="attlist.set-calendar"/> </xs:complexType> </xs:element> -- Ashish Vijaywargiya Indore (M.P), India http://en.wikipedia.org/wiki/Indore On Mon, Sep 1, 2008 at 5:39 PM, Vikas Mayur <[hidden email]> wrote: > Sorry, I was just asking about default-value attribute behavior in > <set-calender> > > - Vikas > > On Mon, Sep 1, 2008 at 5:38 PM, Vikas Mayur <[hidden email]> wrote: > > > I have to do some thing like > > > > <if-not-empty field="parameters.disableForYear"> > > <set-calendar field="disabledDateTime" from-field="nowTimeStamp" > > years="${parameters.disableForYear}"/> > > <else> > > <set-calendar field="disabledDateTime" from-field="nowTimeStamp" > > years="20"/> > > </else> > > </if-not-empty> > > > > I was wondering if above code could be replaced by some thing (using > > default-value or value attribute) > > <set-calendar field="disabledDateTime" from-field="nowTimeStamp" > > years="${parameters.disableForYear}" default-value="20"/> > > > > But doing so I am getting an exception. > > What is the way to perform this operation in <set-calender> tag. > > > > Would appreciate any pointers. > > > > Thanks, > > Vikas > > > |
In reply to this post by Vikas Mayur-2
<set field="disableForYear" from-field="parameters.disableForYear" default-value="20"/>
<set-calendar field="disabledDateTime" from-field="nowTimeStamp" years="${disableForYear}"/> -Adrian --- On Mon, 9/1/08, Vikas Mayur <[hidden email]> wrote: > From: Vikas Mayur <[hidden email]> > Subject: Purpose of default-value, value attribute of set-calender tag > To: [hidden email] > Date: Monday, September 1, 2008, 5:08 AM > I have to do some thing like > > <if-not-empty > field="parameters.disableForYear"> > <set-calendar field="disabledDateTime" > from-field="nowTimeStamp" > years="${parameters.disableForYear}"/> > <else> > <set-calendar field="disabledDateTime" > from-field="nowTimeStamp" > years="20"/> > </else> > </if-not-empty> > > I was wondering if above code could be replaced by some > thing (using > default-value or value attribute) > <set-calendar field="disabledDateTime" > from-field="nowTimeStamp" > years="${parameters.disableForYear}" > default-value="20"/> > > But doing so I am getting an exception. > What is the way to perform this operation in > <set-calender> tag. > > Would appreciate any pointers. > > Thanks, > Vikas |
Thanks Adrian :-)
It looks perfect. -- Ashish Vijaywargiya Indore (M.P), India http://en.wikipedia.org/wiki/Indore On Mon, Sep 1, 2008 at 8:55 PM, Adrian Crum <[hidden email]> wrote: > <set field="disableForYear" from-field="parameters.disableForYear" > default-value="20"/> > <set-calendar field="disabledDateTime" from-field="nowTimeStamp" > years="${disableForYear}"/> > > -Adrian > > --- On Mon, 9/1/08, Vikas Mayur <[hidden email]> wrote: > > > From: Vikas Mayur <[hidden email]> > > Subject: Purpose of default-value, value attribute of set-calender tag > > To: [hidden email] > > Date: Monday, September 1, 2008, 5:08 AM > > I have to do some thing like > > > > <if-not-empty > > field="parameters.disableForYear"> > > <set-calendar field="disabledDateTime" > > from-field="nowTimeStamp" > > years="${parameters.disableForYear}"/> > > <else> > > <set-calendar field="disabledDateTime" > > from-field="nowTimeStamp" > > years="20"/> > > </else> > > </if-not-empty> > > > > I was wondering if above code could be replaced by some > > thing (using > > default-value or value attribute) > > <set-calendar field="disabledDateTime" > > from-field="nowTimeStamp" > > years="${parameters.disableForYear}" > > default-value="20"/> > > > > But doing so I am getting an exception. > > What is the way to perform this operation in > > <set-calender> tag. > > > > Would appreciate any pointers. > > > > Thanks, > > Vikas > > > > |
In reply to this post by Adrian Crum-2
Thanks Adrian - It looks fine and I will test this soon.
But this is more of a alternative solution. I mean what about the usage of default-value attribute on <set-calender>. Is it here for a purpose and if yes is this similar to default-value used used in <set> tag. - Vikas On Mon, Sep 1, 2008 at 8:55 PM, Adrian Crum <[hidden email]> wrote: > <set field="disableForYear" from-field="parameters.disableForYear" > default-value="20"/> > <set-calendar field="disabledDateTime" from-field="nowTimeStamp" > years="${disableForYear}"/> > > -Adrian > > --- On Mon, 9/1/08, Vikas Mayur <[hidden email]> wrote: > > > From: Vikas Mayur <[hidden email]> > > Subject: Purpose of default-value, value attribute of set-calender tag > > To: [hidden email] > > Date: Monday, September 1, 2008, 5:08 AM > > I have to do some thing like > > > > <if-not-empty > > field="parameters.disableForYear"> > > <set-calendar field="disabledDateTime" > > from-field="nowTimeStamp" > > years="${parameters.disableForYear}"/> > > <else> > > <set-calendar field="disabledDateTime" > > from-field="nowTimeStamp" > > years="20"/> > > </else> > > </if-not-empty> > > > > I was wondering if above code could be replaced by some > > thing (using > > default-value or value attribute) > > <set-calendar field="disabledDateTime" > > from-field="nowTimeStamp" > > years="${parameters.disableForYear}" > > default-value="20"/> > > > > But doing so I am getting an exception. > > What is the way to perform this operation in > > <set-calender> tag. > > > > Would appreciate any pointers. > > > > Thanks, > > Vikas > > > > |
Adrian, Ashish, Please ignore my post. I got you.
- Vikas On Tue, Sep 2, 2008 at 11:41 AM, Vikas Mayur <[hidden email]> wrote: > Thanks Adrian - It looks fine and I will test this soon. > > But this is more of a alternative solution. I mean what about the usage of > default-value attribute on <set-calender>. Is it here for a purpose and if > yes > is this similar to default-value used used in <set> tag. > > > - Vikas > > On Mon, Sep 1, 2008 at 8:55 PM, Adrian Crum <[hidden email]> wrote: > >> <set field="disableForYear" from-field="parameters.disableForYear" >> default-value="20"/> >> <set-calendar field="disabledDateTime" from-field="nowTimeStamp" >> years="${disableForYear}"/> >> >> -Adrian >> >> --- On Mon, 9/1/08, Vikas Mayur <[hidden email]> wrote: >> >> > From: Vikas Mayur <[hidden email]> >> > Subject: Purpose of default-value, value attribute of set-calender tag >> > To: [hidden email] >> > Date: Monday, September 1, 2008, 5:08 AM >> > I have to do some thing like >> > >> > <if-not-empty >> > field="parameters.disableForYear"> >> > <set-calendar field="disabledDateTime" >> > from-field="nowTimeStamp" >> > years="${parameters.disableForYear}"/> >> > <else> >> > <set-calendar field="disabledDateTime" >> > from-field="nowTimeStamp" >> > years="20"/> >> > </else> >> > </if-not-empty> >> > >> > I was wondering if above code could be replaced by some >> > thing (using >> > default-value or value attribute) >> > <set-calendar field="disabledDateTime" >> > from-field="nowTimeStamp" >> > years="${parameters.disableForYear}" >> > default-value="20"/> >> > >> > But doing so I am getting an exception. >> > What is the way to perform this operation in >> > <set-calender> tag. >> > >> > Would appreciate any pointers. >> > >> > Thanks, >> > Vikas >> >> >> >> > |
Free forum by Nabble | Edit this page |