KX Community

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

Home Forums KX Solutions Validation on delete in Editable List component

Tagged: 

  • Validation on delete in Editable List component

    Posted by Swapnil on September 3, 2024 at 6:37 am

    Hi Team

    How do we return an error dialog back to the client while doing validation on delete in an editable list ?

    So in the update query section we call our analytic say deleteId which does some validation whether the user is allowed to delete the id or not.
    If the user is not allowed, we want to show an error dialog back to the client

    The analytic throws an exception but that does not get propagated to the client as an error dialog

    {[dgAdd;dgUpd;dgDel]
     /this sample requires keyed table: 
    / table's key matches 'Key' in this dialog 
    / exampleQueries:: id xkey ([] id:int$();name:symbol$();note1:symbol$()); 
    / exampleQueries upsert(0i;dummy;`);
    
    if[count[dgUpd]>0;`screenerFilters upsert flip dgUpd]; 
    if[count[dgDel]>0; deleteId[dgDel[`id]]; 
    /generate unique ids for new items 
    if[count[dgAdd]>0;`screenerFilters upsert flip dgAdd]; }

    jlucid replied 2 weeks, 3 days ago 2 Members · 1 Reply
  • 1 Reply
  • jlucid

    Member
    October 30, 2024 at 3:03 pm

    Looking at the arguments to your function, it looks like you are trying to run an update command in a KxDashboards Data Grid component, is that correct?

    First of all, to throw an error you can use signal (‘), that what works for me. if[notValidUser;’ErrorMessage];

    This should generate a small popup on screen when the user presses submit. Here’s the thing though, the full text “ErrorMessage” may not appear on screen, depending on whether the bug I mentioned below was fixed or not.


    I had a similar issue as you in the past, where the error message was being returned but only the first character of the error messages was being displayed (“E” in this case), see link below for issue and fix. I never got a response on this query so I dont know if it was fixed properly in Kx Dashboards.


    https://learninghub.kx.com/forums/topic/dashboards-direct-how-to-specify-an-error-message-on-data-grid-edit-failure/#post-34947

    • This reply was modified 2 weeks, 3 days ago by  jlucid.

Log in to reply.