Unable to remove item with multiple table structure.

Unable to remove item with multiple table structure.

OSFOSF Posts: 18Questions: 0Answers: 0
edited December 2022 in Editor

Hello,

Please see the screenshot for my database table structure. I use different tables, and all work fine (add, edit).
But "remove" item not work ? Any idea, why ? Missing the METADATA TableName for Row_ID ?

Replies

  • rf1234rf1234 Posts: 2,801Questions: 85Answers: 406

    It should work. Just deleted a row from one of my data tables:

    The only difference I can see is that your row is basically empty and the fields that are not empty are "->set( false )". Not sure whether that makes a difference. It probably shouldn't.

    Have you checked the console for errors?

  • OSFOSF Posts: 18Questions: 0Answers: 0

    Hi,

    Thanks for answere. Yes, i know. Your example works. You are in the same sql Database ? But i use two databases (GMM and METADATA) i have three levels, you only two. I thinks thats the problem…

  • rf1234rf1234 Posts: 2,801Questions: 85Answers: 406

    @allan
    could this be a bug in Editor?

  • OSFOSF Posts: 18Questions: 0Answers: 0

    Think so @allan do you have a idea ?

  • allanallan Posts: 61,438Questions: 1Answers: 10,052 Site admin

    It's certainly possible! Can you show me the JSON reply from the server please from when you make the delete action run? I see the data being sent there, but it would be useful to see the response, particularly since you have the debug option enabled.

    Allan

  • OSFOSF Posts: 18Questions: 0Answers: 0
    edited December 2022

    Hi @allen,

    yes, give me few minutes... But i remember me 99,9% the debug result array was empty.

  • allanallan Posts: 61,438Questions: 1Answers: 10,052 Site admin

    If so, that would suggest that there is an error in this function somewhere. I'd probably need to ask you to add a little debug into it if that's okay?

    Allan

  • OSFOSF Posts: 18Questions: 0Answers: 0

    @allen, you are saving my day....

    It looks like I am using an older editor version.
    I seem to remember that something else stopped working after updating to the new editor version.

    With your sent function everything works as it should.

    I will update to the new editor version this week, and report back to you why my project stopped working after that.

    Thank you both for your support!

  • allanallan Posts: 61,438Questions: 1Answers: 10,052 Site admin

    Hi,

    Thanks for the update. Yes, if you run into any issues with the update, just shout.

    Allan

  • OSFOSF Posts: 18Questions: 0Answers: 0
    edited December 2022

    Hi @allen,

    i have updated to new editor version, and follow exist code no longer work:

    ...
        ->where( function ( $q ) use ($SelectedDvrZeroPoint) {
            $q->where( 'CLIPPINGS.UTC_Start', "'$SelectedDvrZeroPoint'", '>', false );
            $q->and_where( 'CLIPPINGS.UTC_End', 'NOW()', '<', false );
        } )
        ->process( $_POST )
        ->json();
    

    Error:

    {"fieldErrors":[],"error":"An SQL error occurred: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '02:11:34' AND  `CLIPPINGS`.`UTC_End` < NOW()' at line 1","data":[],"ipOpts":[],"cancelled":[]}
    

    $SelectedDvrZeroPoint are "2022-12-23 02:11:34", not '02:11:34'

    This is the Debug

    ...  AND  `CLIPPINGS`.`UTC_Start` > `2022-12-23` 02:11:34 AND  `CLIPPINGS`.`UTC_End` < NOW()  ...
    
  • OSFOSF Posts: 18Questions: 0Answers: 0

    Edit:

        ->where( function ( $q ) use ($SelectedDvrZeroPoint) {
            print_r( $SelectedDvrZeroPoint );
            $q->bind(':zeropoint', $SelectedDvrZeroPoint);                
            $q->where( 'CLIPPINGS.UTC_Start', ':zeropoint', '>', false );
            $q->and_where( 'CLIPPINGS.UTC_End', 'NOW()', '<', false );
        } )
    

    Shows me:

    2022-12-23 02:31:44
    {"fieldErrors":[],"error":"An SQL error occurred: SQLSTATE[42S22]: Column not found: 1054 Unknown column ''2022-12-23 02:31:44'' in 'where clause'","data"
    
Sign In or Register to comment.