0

How can I set up two fields, one showing date/time record was created, one showing date/time of last modification?

No clue as to what is required here

19 replies

null
    • Ninox partner
    • RoSoft_Steven.1
    • 5 yrs ago
    • Reported - view

    maybe with this? :

    Get the creation date of the current record: _cd
    Get the date of last modification: _md

    • toghome
    • 5 yrs ago
    • Reported - view

    Thank you, Steven. 

    I'm just starting out.

    Is there a beginner's guide to Ninox scripting syntax somewhere?

    Is there a list of all possible scripting elements somewhere?

    Right now, I have a field of type Date/Time labelled "Date Modified". I want to take advantage of Steven's  _md, but I have no idea into which option or even into which object to put it. Does it go into my "Date Modified," or is it somehow attached to the record itself?

    I also don't know how to build it out into an effective formula. (Sorry for my level of ignorance.)

    • Ninox partner
    • RoSoft_Steven.1
    • 5 yrs ago
    • Reported - view

    Hi ecom,

    First create a formula field. Name this field Created on: or something you want. Use text(_cd) as formula for this field. 

    I’m also a beginner with Ninox and i find the webinars very interesting!

    Sorry for my English... I’m dutch

    • Ninox partner
    • RoSoft_Steven.1
    • 5 yrs ago
    • Reported - view

    Same for _md

    • Nick
    • 5 yrs ago
    • Reported - view
    • toghome
    • 5 yrs ago
    • Reported - view

    Thank you so much!

    • toghome
    • 5 yrs ago
    • Reported - view

    Still struggling with Date Created and Date Modified using the Mac version 2.4.3.

    Date Created, using the formula, "text(_cd)", auto-modified to "text('Created on')", shows proper date and time when a new record is created, but, when I touch the cloud icon and then reopen the record, the date is gone.

    Date Modified, using the formula, "text(_md)", acts just the way Date Created does: It constantly shows the creation date & time, not the modified date & time, never updating when I change data even in multiple fields, and the data likewise disappears when the cloud icon is touched.

    Am I doing something wrong, or are these bugs?

    • toghome
    • 5 yrs ago
    • Reported - view

    Date Modified will be set to Date Created when a new record is created.  If working with an old card, field remains blank, so only time it appears to be triggered is during the creation of a new record.

    Also, I am using iCloud, not Ninox Cloud

    • Nick
    • 5 yrs ago
    • Reported - view

    Created on, Modified On and _cd, _md don't work with Mac app.

    I use triggers for that:

     

    Screen Shot 2018-11-06 at 21.46.21

     

    Nick

    • toghome
    • 5 yrs ago
    • Reported - view

    I see now I was working in entirely the wrong place. This function has to be done in the Edit Fields... option in the Table menu.

    I first created two new Date/Time fields titled Created on and Modified on.

    Then, in the Table | Edit Fields dialog, under "Trigger on create," I entered the formula: 'Created on' := now()

    In the Trigger after update, I entered: 'Modified on' := now()

    Everything now works perfectly!

    • toghome
    • 5 yrs ago
    • Reported - view

    Thanks, Nick. Your solution posted while I was writing mine. Apparently, they've fixed "Created on" and "Modified on" as they appear to be working now. My biggest problem was that I was trying to enter the formula in the fields I had created to hold the dates, since I didn't know about the built-in trigger boxes in the table-specific stuff under "Table | Edit fields..." So much to learn!

    • chuckhoffman
    • 4 yrs ago
    • Reported - view

    I'm having a similar problem, on both iPad and iPhone. I set the Trigger on Create and Trigger After Update as indicated in this message thread. For the Modified Date, I used the formula;

    format('Modified on', "MM/DD/YY")

    The creation date is put into this field when a record is created. But there are two problems:

    1. The data never changes after I modify the record.

    2. When I close the database, then reopen it, the dates are gone.

    What am I missing?

    • chuckhoffman
    • 4 yrs ago
    • Reported - view

    Sorry, I meant "The date never changes" in point #1.

    • Tony
    • Tony_Ryder
    • 2 yrs ago
    • Reported - view

    Is there a way to add seconds to the formula.

    • Lorenzo_Milani
    • 1 yr ago
    • Reported - view

    https://forum.ninox.com/t/m1hr810?r=m1hrk46
    is there a way to do this as a formula instead of a trigger so I can format the output? Thanks

      • Ninox partner
      • RoSoft_Steven.1
      • 1 yr ago
      • Reported - view

      Lorenzo Milani Only put _cd or _md in a formula field. _cd for creation date and _md for modification date.

      • Lorenzo_Milani
      • 1 yr ago
      • Reported - view

      RoSoft_Steven Rooryck This gives me the date for the entire record not for a single field.

      • Ninox partner
      • RoSoft_Steven.1
      • 1 yr ago
      • Reported - view

      Lorenzo Milani Yes your're right, didn't know that was your question. I have a solution/trick for your case: If you want to monitor for example a field called "Input" , you create two Date/Time fields, one called Created and another Modified for example.

      These can be hidden in the settings of the fields > Display field only, if:  null

      You can "call" these fields in a formula field, which are stylable and is your use case.

      Now using the "Trigger after update:" of the field "Input" you can fill the two Date/time fields:
       

      if not Created then
      Created := now();
      Modified := now()
      else
      Modified := now()
      end
      

      Yes, using triggers is still needed.... and this would be a Change Request for Ninox, having the possibility to add a variable in the _md and _cd functions like for example _cd(Input) where "Input" is the field you want to monitor.

      • Lorenzo_Milani
      • 1 yr ago
      • Reported - view

      RoSoft_Steven Thanks, It works! Nice work around. Sorry for the response delay.

Content aside

  • 1 yr agoLast active
  • 19Replies
  • 5898Views
  • 2 Following