Date Picker and Expression Box Issues

J

Janie

Hi. I'm trying to get an expression box to display the date from a date
picker. But, the formatting is always YYYY-MM-DD. I want DD-MMM-YYYY
(10-Feb-2006) if possible or DD-MM-YY.
 
S

S.Y.M. Wong-A-Ton

Both are possible with a little bit of rule trickery.

For the DD-MMM-YYYY scenario you would have to create 12 rules (1 for each
month of the year) on the date picker to set the expression box's value, as
well as a condition on each rule to run only when the corresponding month is
selected.

Example rule for February:

Action: Set a field's value
Field: <your expression box>
Value: concat(substring(., 9, 2), "-Feb-", substring(., 1, 4))

Condition on rule (Select "The expression" from the first dropdown list box
in the Condition dialog box to be able to enter the following expression):
number(substring(., 6, 2)) = 2


For the DD-MM-YY scenario you only need to create 1 rule on the date picker.

Action: Set a field's value
Field: <your expression box>
Value: concat(substring(., 9, 2), "-", substring(., 6, 2), "-", substring(.,
3, 2))
 
J

Janie

Used the second option, but instead of a rule, I just added
[concat(substring(., 9, 2), "-", substring(., 6, 2), "-", substring(.,3, 2))]
to the field in my expression box...works great. Thank you!
 
J

Janie

Actually....just found that you can select "date" format in the expression
box. But it looks like it only works if the date picker's date format is one
of the ones with a * next to it.

Janie said:
Used the second option, but instead of a rule, I just added
[concat(substring(., 9, 2), "-", substring(., 6, 2), "-", substring(.,3, 2))]
to the field in my expression box...works great. Thank you!

S.Y.M. Wong-A-Ton said:
Both are possible with a little bit of rule trickery.

For the DD-MMM-YYYY scenario you would have to create 12 rules (1 for each
month of the year) on the date picker to set the expression box's value, as
well as a condition on each rule to run only when the corresponding month is
selected.

Example rule for February:

Action: Set a field's value
Field: <your expression box>
Value: concat(substring(., 9, 2), "-Feb-", substring(., 1, 4))

Condition on rule (Select "The expression" from the first dropdown list box
in the Condition dialog box to be able to enter the following expression):
number(substring(., 6, 2)) = 2


For the DD-MM-YY scenario you only need to create 1 rule on the date picker.

Action: Set a field's value
Field: <your expression box>
Value: concat(substring(., 9, 2), "-", substring(., 6, 2), "-", substring(.,
3, 2))
 
Top