How to add a timestamp field using Composite C1?

♀尐吖头ヾ 提交于 2019-12-25 01:28:57

问题


How can I add ChangeDate field to a global datatype in data perspective? I can add CreateDate field easily but stuck at record modification time.

This is how I add CreateDate field:

  • Just add a new field and rename it as CreateDate, type is Date

  • In the advanced tab; remove widget and set default value as function Now.

Can I add another field which one keeps the modification date automatically, if any?


回答1:


I think event tracking of data addition and updating gives you a solution to add modified date.

You can even remove this modified date field from Mark up. But this will be in DB.

The five events that can be tracked in composite c1 data types are

  1. OnAfterAdd

  2. OnAfterUpdate

  3. OnDeleted

  4. OnBeforeAdd

  5. OnBeforeUpdate

More information on data addition on the following link.




回答2:


From: burningice

There is a package for it here which you can use to enable ChangeHistory on dynamic types https://bitbucket.org/burningice/compositec1contrib/src/8f53d846304f4dea942b9169481ea3e53580804e/ChangeHistory/?at=default

For static types, just make sure to inherit the Composite.Core.Types.IChangeHistory interface. Read the full discussion online.



来源:https://stackoverflow.com/questions/23301852/how-to-add-a-timestamp-field-using-composite-c1

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!