Okay
  Public Ticket #1738617
Capturing Last Update Date
Closed

Comments

  •  2
    Alan started the conversation

    We keep the User ID to limit the editing so we would assume the WP User ID does not change when an edit is done IF we keep the Edit Limit on, in addition, is there a way though to capture the DATE of when the edit is made?  We keep a Last Update Date similar to what ORACLE does in it's database records.  If we edit via WPDATATABLES versus a FORM which captures IDs and DATE TIME Stamps (i.e. "today;"), we do not see where we can keep this database record current for that field or is there a way to use some notation on the Column's parameters?


    I viewed the INFORMATION FOR DEVELOPERS, I see DATE and TIME values in FILTERS, but this is the data being returned to the screen/page, correct?


    wpdatatables_filter_date_cell( $formattedValue, $tableId )

    This filter is applied to the value of a date cell before it is returned to the front-end.

    $formattedValue is the value of the cell.

    $tableId is the table identifier from the MySQL table (wp_wpdatatables).


  •  1,689
    Miloš replied

    Hi Alan,
    Thank you for your purchase.

    Sorry but I did not quite understand what are you trying to achieve.

    Can you please describe me more what do you mean by this is there a way though to capture the DATE of when the edit is made?


    Best regards.

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  •  2
    Alan replied

    Sure, sorry, let me try to be more succinct, I was in the middle of all that last night and I think my thoughts came rushing out non-stop.

    I have a field in each MYSQL table called LAST UPDATE DATE.  When I do an INSERT using Forms into MYSQL, I pick up the current date, they have a constant identifier called "today;".  this keeps a record when a database record is edited/inserted.

    Since the forms do not do well for multi field updates, this is where I like to use WPDATATABLES and I want this field to update automatically since I cannot guarantee the data entry person will remember to change this field to the current date they do the edit.

    [think of it like an extra given field or an admin like field that has to be updated, but is not really part of the actual data in the business - it is more for table operations, auditing]

    Is there some way, possibly JS, but before I tax my limited brain power source lately, to auto-fill this field with today's date when the row is edited.  Upon writing this, I am also thinking that it would not since editing using your app triggers when just a column is changed, actually it goes to edit if no value is changed, just makes a call to the database but no value changes.  

    [for instance, I noticed when I am editing a table, I click on a field, but never change the value, then when I tab out, it appears to call MYSQL even though nothing changes there in value]

    Which bring another thought, that since a call back to MYSQL is done even if a field's value is not physically changed, auto-filling LAST UPDATE DATE may be in error based on WPDATA calling the database, we would need to auto-fill only when a field value really changes (onChange).

    Same would go if I wanted to capture the ID of the person doing the update, however since you have the cool feature of EDIT LIMITING, we know that only the person who can EDIT the data would logically be the person who LAST UPDATED BY.   I added this since it may help show the same logical goal we want.

    In the end, it is the idea of auto-capturing values to avoid the mistakes that a data entry person could make like forgetting, on purpose or not, to change the date to show it was updated that day.  Sounds like JS, but I find that JS in plugins does not always work well the first time out, lots of trial and error, at least in Form Maker it took some time to learn how to integrate with their DOM.

    Let me if I still muddied water.

    Could this be really a suggestion to add a feature, since Oracle, and probably many, commercial databases have this audit driven field, WPDATA could offer it as a function as long as the MYSQL has a place for it, very much like the ID you offer for EDIT LIMITING.  The designer has to accommodate it in the database.

  •  1,689
    Miloš replied

    Hi Alan,

    Thank you for your explanation now I understand what are you trying to achieve. You want to trigger the database only when the entry is changed not when the , for example user clicks to edit the row and then just check the data and close the modal without changing anything.

    For now all the callbacks and methods that we are using ( for some other reasons) are triggering the database and save the data again, but I get your point.

    Unfortunately for now something like this is not possible but your idea is quite good and I will add it on our TODO list and hopefully we will implement it for some future versions. Currently we are implementing some new features and we are preparing some kind of survey where the users will vote and give their suggestion of features that they want to see.


    Best regards.

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  •  2
    Alan replied

    ok thanks, I am not sure how to close tickets, I guess you guys do that on your end.

  •  1,689
    Miloš replied

    Hi Alan,

    No problem, I will close this one for you.


    Best regards.

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables