Converting three attributes (string and enums) into one attribute (DateTime)

10
An object in my project got three attributes which I want to convert to one new attribute. I would like to convert the following attributes: - ExpectedYear (string) - ExpectedQuarter (enum) - ExpectedMonth (enum) I would like to convert those values into a new attribute: - ExpectedDate (DateTime) It's fine to set the date on the first day of the 'ExpectedMonth' and time the first second of the day. How can I do this?
asked
2 answers
6

At first thought you can try something like this

dateTime( parseInteger($InputMetaObject_1Object/ExpectedYear), parseInteger(toString($InputMetaObject_1Object/ExpectedMonth)) )

However, the dateTime function doesn't accept variables as input. So you need to do create a String representing the date. This string can be parsed into a date.

Example: parseDateTime( $InputMetaObject_1Object/ExpectedYear + '-' + toString($InputMetaObject_1Object/ExpectedMonth) + '-01', 'yyyy-MM-dd')

Note that you for parsing the enumeration ExpectedMonth into the right month number you need to specify the values of this enumeration as follows:

  • name: 1, caption: January
  • name: 2, caption: February
  • etc.
answered
1

You can look here for the specific microflow expresion that you will need to convert the three values into a datetime format: Microflow expressions.

At 'date values' you will find this expression, which should do the trick: Input: year, month, day dateTime(2007, 1, 1) "Mon Jan 01 00:00:00 CET 2007", you will probably need to convert the enumerations to strings first.

good luck!

answered