Good morning!
I am using an input field to populate Creation date which is a System entity, reason why I cannot change it to be just Date on the input field. Any suggestion on how I can change this setting? It doesn't make much sense for me to have the time at which the user was created.
Hi Helga,
I attached the OML regarding your issue. You can refer the demo
Demo
Thanks,
Sriyamini J
Thanks! This solved my issue :)
Hi Helga.
You can use the action DateTimeToDate.
Hope this helps.
Hi @Helga Afonso
you can use the in built function, like mentioned below:
DateTimeToDate(Entity.DateTimeAttribute)
in displaying the creation date., this might help.
Dhanasingh Dennison.
Hi,1.FormatDateTime(CreationDate, "yyyy-MM-dd")2.Create a Local Variable of type Date.3.Bind it to the input field.4.DateToDateTime(UserInputDate)Thanks,sahana
where do I apply steps 1 and 4?
Hi,
You can use this one
FormatDateTime(Entity.CreationDate, "yyyy-MM-dd")
When creating a record in your entity, on the DateTime attribute apply the action DateTimeToDate(DateTimeAttribute)
Since User is a System entity I cannot change it
From what I understand, you're trying to save a new user in the User entity.
Since, as you mentioned, this entity cannot be modified, you'll need to store it as a DateTime.
For auditing purposes, having the user creation attribute as a DateTime can be useful.
Hi,1.Create a local variable (CreationDateFormatted) of type Date.2.Set its value CreationDateFormatted = DateTimeToDate(User.CreationDate)
3.Bind the input field to CreationDateFormatted Thanks,sahana
can you pls refer the below attached oml, If it helps.
Sivasakthi
Please try FormatDateTime
Hi @Helga Afonso,
I understand your problem. You want to display Creation_Date of User entity(probably) to an input field in your screen in simple date format but this is a system entity having DataTime format so mapping directly your aggregate attribute to Input field is not going to work. You need to map a local variable to your Input field first(snap1) and that local variable you need to update on OnAfterFetch event of that aggregate like below:
Note: Creation_Date is of Text data type because FormatDateTime() output in text format.
This will be your OnAfterFetch event:
Cheers
Hi Helga,Instead of modifying the system entity itself, you can format the value when displaying it in the input field. If you're using OutSystems, you can apply formatting like this:
FormatDateTime(CreationDate, "yyyy-MM-dd")
This will ensure that only the date is shown while the time part remains stored in the system.
You definitely always should record the time at which a record is created, but of course such an attribute should be auto-filled by the code (ideally in a save wrapper), not entered by the user!
Also, you should consider creating a structure for your input, instead of directly using a system entity, then mapping the attributes of the structure when saving the record.
Hello Helga
May I suggest using an option with a large set of functions to deal with dates and datetimes:
https://www.outsystems.com/forge/component-overview/16516/dateplus-o11
Thanks