Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I'm using Vizlibwriteback to input data in Qlik Sense.
Between my front end table and my table in the database, I have a key : EntryRef.
When I add a row in my front end, I need the entry ref column to be automatically filled with a unique entry ref.
What I tried :
- Add a default values in the properties with the expression : =max({1} EntryRef)+1
Issue : The expression is evaluated based on EntryRef in my data model. If I add 2 rows without saving in between, the first row takes a value but it's not saved yet in the data model (because not reloaded yet) and the second row takes the same value as the first one.
- Add a default values in the properties with the expression : =round(num(now())*24*60*60) to get a different id every second.
Issue: it looks like the refresh frequency of vizlib is very low... When I add multiple rows, it displays the same ID, like if the now() function was not evaluated at the moment I add the row.
- Leave the EntryRef column empty in the front end and make a Identity field in the database so that it generates a unique ID in the DB.
Issue, the target table is a temporal table (to track changes). It's apparently not allowed to have Identity field in a temporal table.
Any Idea?
Thanks!
Hey Maxime,
I don't have Writeback up and running now, but why don't you change the calculation to:
max( Total Expression1) + RowNo()
By using RowNo() and Total you can update the next rows.
Jordy
Climber
Hello Jordy,
Thanks for the reply!
Unfortunately, your expression is evaluated on data in your data model. In vizlib, when you press the button "Add row", it adds a row in your front end vizlib table, but it doesn't reload your app until you press the "save" button. When "save" is pressed, a partial reload is performed and the added row is inserted in your data model.
So, if I add 2 rows without pressing the "save" button, the expression will be evaluate on the same dataset and both rows will have 902 (if I take the data in your screenshot) as value.
In vizlib the is 3 column type : "Dimension", "Measure" and "Column". If I use a measure, it's related to my in memory data so it doesn't work. If I use a Calculated column, functions like rowno() are returning 1 on every line...