KX Community

Find answers, ask questions, and connect with our KX Community around the world.

Home Forums KX Solutions Dashboards Direct – How to specify an error message on Data Grid edit failure

  • Dashboards Direct – How to specify an error message on Data Grid edit failure

    Posted by jlucid on June 30, 2023 at 12:00 am

    I have a Data Grid component with Edit mode enabled, users can only update cells, not add or delete.

    In my user defined update function, which upserts the users entry, I have put in some validation checks before the upsert to ensure the values are within a given range.

    If the validation fails, I return an `ERROR_MESSAGE symbol, and this prompt the Dashboard to display an

    error  message in Red which says “An error occurred executing the update query: Error text: t”

     

    Is there a way for me to to replace the “t” with a message corresponding to the validation check that failed?

     

    Thanks

     

     

    jlucid replied 1 month, 3 weeks ago 1 Member · 3 Replies
  • 3 Replies
  • jlucid

    Member
    June 30, 2023 at 12:00 am

    If I modify my update function like below, where when the if statement is true it hits an undefined variable

    “BadValueInputted” then the error message on screen just shows the first character of the missing variable, the “B”, so the Error message appearing on screen is ” “An error occurred executing the update query: Error text: B”.

    Is there a way to display the full text and not truncate?

     

    {[dgAdd;dgUpd;dgDel]
     if[not (first dgUpd[`Current]) in 10.0 20.0;
       BadValueInputted
     ];
    $[((count dgUpd)>0);`testTable upsert flip dgUpd;];
    }

     

     

  • jlucid

    Member
    July 2, 2023 at 12:00 am

    The solution I found for this problem was to open the file below

    dash/www/modules/Datagrid_9fde571/main.js

     

    And replace the line

    r=function(e){this.showMessageSubmitError(e[0])}.bind(this)     [First character being returned]

    with

    r=function(e){this.showMessageSubmitError(e)}.bind(this)

     

    Now when I submit an edit to the Data grid cell, and force the update function to fail (with a mock validation check),  the error message returning is showing the full error message.

    If someone else has a better solution please let me know

  • jlucid

    Member
    November 18, 2023 at 12:00 am

    In version, 2.1.0 I see the same issue in modules/Datagrid_b71a7f6/main.js

    replacing e[0] with e does the job to show the full error message.
    Please let me know if this one is being tracked or was already fixed in a patch, thanks

Log in to reply.