Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
datanibbler
Champion
Champion

Frontend for a Database - another issue with updating

Hi,

I'm just building the frontend for a database.

The background of this is, we get data from our customer on a regular basis and a lot of people in our company work on this, so I'm building a database for it - well, I'm building the frontend whereby the database will be the qvd, but I think that should be enough, we don't have that much data in there.

There are three background actions on the database:

- Load a new base_file and check for any records which are not yet present in our database (and append those)

- Load the existing database (reload the qvd, which will include any changes already made and saved by others)

- Update one record (this will reload the qvd, so no changes made by others in the meantime can be lost) and insert new values just in

   those fields where the current user has entered new values)

The issue I am currently facing is this:

- There are a lot of variables in my script (one for every field, so I have the option of entering new values at all)

- A user can  have either RW or RO access to a field; Accordingly, there is an Inputbox for that field or a Textbox.

- The variables all have a variable value (like >> SET myvar = = [fieldname] <<) so they are populated with values only on the
  GUI, once the user has made a selection on a field (e.g., the user selects one (exactly one) row in the database to edit and all the
   variables (in the fields that user can edit) reflect the value of that field in that row).

- The variables are all named like >> edit_[fieldname] << and I have a variale v_line_ID_edit which is a fixed value (to be entered by the
   user) to denote the exact record that the user means to edit.

Now, when a user selects to update the database with changes made to one record, the qvd is reloaded - but, since every field can be edited by someone (not necessarily the current user) every line in that LOAD reads like

>> IF rowNo() = $(v_line_ID_to_edit), '$(edit_ blabla)', blabla) as blabla <<

The variables are not reset since otherwise those changes would be overwritten - but since for that particular record only variables are loaded, every field in that record afterwards reads like >> = [fieldname] <<

This has been a rather long explanation, but I don't have the time to make it shorter 😉 I hope it is clear what exactly my issue is. If not, just ask and I'll rant on until evening ...

Can anybody advise me here?

Thanks a lot!

Best regards,

DataNibbler

4 Replies
datanibbler
Champion
Champion
Author

P.S.: I guess for that to work, I will need another set of variables to take on the value 1 if a field has been edited
=> Then I will need that IF_construct in the qvd_LOAD for updating that record

<=> Otherwise, that variable will have the value 0 and in that qvd_LOAD, I will just reload the field such as it is.

<=> For that, I will need a table where the user can just select all the fields that he/she has edited and the respective variables will all toggle to 1. That will influence the LOAD in the script. By slightly editing the look of a listbox, I can make it like a nr. of checkboxes that the user can just tick.

Pretty easy - but I guess there's a lot of work waiting for me ... let's not keep it waiting.

datanibbler
Champion
Champion
Author

P.S.: Okay - I can do this without the extra work for the user to once more select all the fields that he/she has edited.

That way, the LOAD in the script will be quite complicated, but never mind.

For every field that I load from the qvd, I have to (for that one record selected for editing) check whether that field_variable holds any value other than the original field_value in the qvd and, if so, I fill this into the table i create, otherwise I just go with the original field_value. That table will then be immediately stored again, so the potential for "colliding" with edits being made by someone else is minimal.

datanibbler
Champion
Champion
Author

Hi,

this seems to be more complicated than I thought.

I think I must have the syntax wrong for the LOAD or something.

The thing is, when I have prepared 3 input_boxes in this way (to load the user_input into the table instead of the original field, but only if

- the line is the one the user has chosen for editing AND

- the input_box has been edited, so it now holds another value than the original field

=> What happens is, when I then use just one of those input_boxes, then in that one line that I have chosen for editing,
     that value appears all right and the other two prepared fields look like >> = [original_field] << (because that's what
     these variables look like)

Maybe anyone can help me there?

I will now try to maybe do it in two steps, with a RESIDENT LOAD.

Thanks a lot!

Best regards,

DataNibbler

datanibbler
Champion
Champion
Author

OK.

Seems now I have made it. Let's see.

There is now another variable involved - now I have 3 per field, that's quite a lot ...

That variable is like a checkbox (well, it IS assigned to a pair of textboxes with the image of a checked and an unchecked checkbox) where the user has to tick whether he has edited a particular field - right under the input_box.

The alternative would have been using a small table with all the fieldnames, but then the user would have had to decide beforehand which fields he/she would edit and there would have been a potential for mistakes (I mostly assume that users will make mistakes wherever they can, so I try to minimize that possibility).

That variable can then be used in the script_reload to decide whether the field_variable or the original field should be loaded into a temporary table.