syntax to concatenate existing field value using server side events please

syntax to concatenate existing field value using server side events please

crush123crush123 Posts: 417Questions: 126Answers: 18

I have a postEdit event which calls a function to update a database table like so...

function editPatronPayment ( $db, $id, $values ) {
    $today = date("Y-m-d");
    $itemid = $values['tblorderdetails']['DetailItemID'];
    $db->push( 'tblitem', 
        array(
            'Donated' => '1',
        'ItemNotes' => 'Item Marked as Donated on '.$today.' as it was returned after the Patron Payment was made'
            ),
        array(
            'ItemID' => $itemid
            )
    );
}

i want to change the ItemNotes field update - so the note is appended to the existing value rather than overwriting it

This question has an accepted answers - jump to answer

Answers

  • tangerinetangerine Posts: 3,342Questions: 35Answers: 394

    Don't you need pre- rather than post- Edit?

  • crush123crush123 Posts: 417Questions: 126Answers: 18

    i am using post edit so that the related table is not affected unless the edit is completed.

    the code posted above works as is, its just that i lose any pre-existing value of the item notes field

  • tangerinetangerine Posts: 3,342Questions: 35Answers: 394
    edited July 2017 Answer ✓

    Docs definition of postEdit:

    Post-row edit event - triggered after the row / page has been updated.

    I must be missing something. Are you saying "update table A, then do something to table B"?

  • crush123crush123 Posts: 417Questions: 126Answers: 18
    edited July 2017

    Yes, in answer to "update table A, then do something to table B"?

    the table being edited in editor is tblorderdetails (table A)

    the table being edited as a postEdit event is tblitem (table B )

    Previous comment incorrectly marked as Answer

    It clarifies my scenario, but it doesn't address the original question

This discussion has been closed.