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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Dynamic Update Question

Hi to all,

I have a problem using Dynamic Update Command. I need to insert all the rows of a linear table into another one. I did it with a for .. next statement

The macro is here below

sub list

Dim strsql

set obj = ActiveDocument.GetSheetObject("CH02")

MsgBox ("number of rows " & obj.GetRowCount-1)

set curDoc = ActiveDocument.GetProperties

curDoc.EnableDynamicDataUpdate=true

ActiveDocument.SetProperties curDoc

for RowIter = 2 to obj.GetRowCount-1

set cell = obj.GetCell(RowIter,1)

set cell2 = obj.GetCell(RowIter,10)

MsgBox(RowIter & " " & cell.Text & " " & cell2.Text)

strsql = "INSERT INTO prova (monthyear, percentualeRientri) VALUES ('"& cell.Text & "','" &cell2.Text &"')"

set Result = ActiveDocument.DynamicUpdateCommand (strsql)

if Result = false then

MsgBox Result.ErrorMessage

end if

next

ActiveDocument.Save

end sub




0 Replies