7 Replies Latest reply: May 19, 2015 8:22 AM by Friedrich Hofmann RSS

    Annoying problem with updating data from Input_Boxes

    Friedrich Hofmann



      I have a quite annoying problem with the updating of data in a "database" (a qvd file). Any help on this would be greatly appreciated.


      - In my app, there is basically one Input_box per field where, depending on their privileges, the users can (or cannot) enter data
        => If they cannot or do not enter data, then I want to load from a qvd with the original field_content

        => If they do enter data, then obviously I want to use that to update one record (but only one of course) in the qvd.

      - All the variables by default show the current field_content.

      - Since I have no other way of recognizing that any field has been edited, the user has to tick a checkbox underneath the field (and
         toggle a variable) so when reloading the script, I have a way of telling whether to use this or that in the LOAD.


      In the LOAD (the script is reloaded via a button on the GUI), I have a rather complicated construct:

      >> IF($(field1_edited) = 1, IF(rowNo() = $(v_line_ID), '$(edit_field1)', field1), field1) as field1 <<

      => That means, when the variable > field1_edited < has the value 1 (that is the checkbox), then I query the line (the user must choose
           exactly one record for updating) and if that is right, I want to enter the variable > edit_field1 < in the resulting table, otherwise the
           original field_content (that is part of a LOAD from the qvd).


      Now, this works fine - if I edit one field and tick its checkbox - and I have that code in place - and select to update the database, the new entry appears.

      The issue is, I have 38 fields which means quite a lot of typework in that LOAD. And somehow when I insert that code for every line in the LOAD, at some point something goes wrong and I get a script_error ("error in expression - ')' expected").

      I'm afraid I will have to go one line at a time and test it every time.

      Can anybody imagine why it works fine at first and at some point it breaks? I do it very carefully to avoid typos - at first I tried building the complete statement in Excel and just copying it, but I abandoned that for the same reason.


      Thanks a lot!

      Best regards,