Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Join this live chat April 6, 10AM EST - QlikView to Qlik Sense REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
padmanabhv
Contributor III
Contributor III

SQL Insert Data from a variable and from edit script load

May seem like a long-ish question.
I have 1. An input box where users can enter a comma separated list of fruits for example:
vFruit = apple, orange , mango

2. Clicking on a button creates a reload, which then takes into account how many fruits were entered (here, 3) , then does a sql select from a db and gets me 3 unique IDs, lets say :
newIDS =  123,456,789

What I want:
The same edit script to do a sql insert:
sql insert into DB 
values (apple,123),(orange,456),(mango,789) ;

 

I cant seem to figure out how to create said sql insert statement using the 'newIDS' and looping through all the values in vFruit in the edit script, so that dynamic reload (i have a condition vFlag = 1, so only that portion runs)

 

Thank you !

1 Reply
Brett_Bleess
Support (Former)
Support (Former)

Firstly, I would caution against performing write-backs to databases using QlikView, this is not really what the product was intended to do and could lead to unintended consequences.  That being said, I suspect you have not gotten any responses, as I was a little confused on exactly what you are asking here, it is not clear exactly what piece you need help solving?  

You would need to enable EXECUTE and the Write options in the Desktop Client script editor, not sure whether you have done that or not:

https://help.qlik.com/en-US/qlikview/April2019/Subsystems/Client/Content/QV_QlikView/Scripting/Scrip...

https://help.qlik.com/en-US/qlikview/April2019/Subsystems/Client/Content/QV_QlikView/Edit_Script_dia...

See Settings option on the second link to allow the Read/Write.

Best I can offer with what you provided.

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.