I'd like to build a what if tool, I know we can use INPUTFIELD to modify existing record values with table box, but what if I want to add new record instead of adjusting existing one, what is in my mind is that we can place an input box for each column, user can manually input the value and click "Add" and insert this new record in existing table, how can I achive this? Thanks.
Strictly speaking, you could:
LOAD * INLINE [
Store Fruit into fruit.qvd;
I've attached my demo. I hope it helps you.
With kind regards,
As Ronald says you CAN add a record to your data model but as Andrey says you CANNOT add a record to the source database.
So when you talk about adding a new record, to what do you want to add the record to?
You're correct of course and I hesitated before saying "CANNOT" but going down that route is not for the fainthearted and takes us away from standard QlikView functionality. Although QV can run macro scripts I consider that stepping outside of QV. You may disagree. If you write a script that successfully executes SQL commands on the source database using variables from the QV app without the user leaving QV then you have justification in taking a different point of view.
I have a couple of apps that do update flags on a SQL Server database but adding new records is something I would never do from within QV, but that's just my view and I can't say that you're wrong.
Of Course effinty2112, Qlikview is not a tool to modify SQL databases, there are a lot of tools that do it better. I never INSERT in a database from QV (only UPDATE flags as you).
I don't know what our colleague exactly need, maybe he needs to write in a table when the Qlik app is connected to the database as a log, then he can do it with Qlik.
As all the best practices rules and programming patters, you can not to follow step by step if is necessary in your development.
this is the exact case I need to deal with, this is my first idea in my mind to append the data into QVD and reload, but it is a heavy operation if the volume is big, is there any smarter way we can try?
btw your demo doesn't work for me, I tried to add some fruit but the table remained the same.
I agree, modifying database within QV is not good idea,I prefer changing inside of QV(memory) for "what if" purpose, I don't need to store the changes back to original source.