No announcement yet.

[SOLVED] Unable to edit a line on an editable grid form

  • Filter
  • Time
  • Show
Clear All
new posts

  • [SOLVED] Unable to edit a line on an editable grid form

    Not sure what I am doing wrong.

    I have an editable grid form set up.

    The SQL is has skid_tag_num defined at the primary key.
    The WHERE is
    I have a unique key defined:
    UK1: skid_tag_num + line_num
    When I tried to update a row from the grid, I got the error message
    Error updating database - record not found
    So I turned on debug and got this SQL.

    select count(*) from skid_tag_det where (skid_tag_num = 244304 AND line_num = 4) AND (skid_tag_num <> 244304)
    That SQL will never return any records.

    Anybody got a suggestion on what is going on?



  • #2
    You cannot change keyvalues in scriptcase using the standard functions. If you have a sql like update mytable set field='abc' where field='def' then this cannot be generated from the form. It will generate a sql like update mytable set field='def' where field='def'. This record will not be found and generates an error. If you need to change keyvalues you can add a custom button and apply your own code, or change the tablestructure in a way that you have a unique key (ie. rowcount) and use secondairy indexes on you foreign 'primary' key. Then this will work. I.e.

    table x,
    myuniquenumber = primary key

    create unique index on x (myoriginalprimaryfield).
    Albert Drent
    aducom software netherlands
    scriptcase partner, reseller, support and (turn-key) development /


    • #3
      Thank you for your prompt response Albert.

      Unfortunately, either I do not understand your response, or I did not ask the question correctly.

      I am not trying to change the keyvalues. Both skid_tag_num and line_num are set to read only. What I am trying to do is something like this:

      SET partial_quantity=600 WHERE skid_tag_num=244304 AND line_num=4


      • #4
        SOLVED - Unable to edit a line on an editable grid form

        I figured out what to do to fix this.

        I needed to set the Primary keys to skid_tag_num and line_num in the SQL for the form.

        And NOT define a Unique Key.

        The generates the proper SQL to check for the row and update the items with the right WHERE clause.

        Thank you.