Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to use Dynamic update action in QV 11

Hi,

Can any one tell me how to use the Dynamic update action in QV 11 .. Do We need to write macro to use this?

53 Replies
Not applicable
Author

And here is one example for updating up to 1.000.000 rows:

sub Match()

   set doc = ActiveDocument

   SQL_String=""

   BelegID=""

   set vMatchID = ActiveDocument.Variables("vMatchID")

   MatchID=vMatchID.GetContent.String

   set vMatchTime = ActiveDocument.Variables("vMatchTime")

   MatchTime=vMatchTime.GetContent.String

   set vMatchUser = ActiveDocument.Variables("vMatchUser")

   MatchUser=vMatchUser.GetContent.String

   set vMatchComputer = ActiveDocument.Variables("vMatchComputer")

   MatchComputer=vMatchComputer.GetContent.String

  

   set mySelections = doc.fields("BelegIDAuswahl").GetSelectedValues(1000000)

    for i = 0 to mySelections.Count - 1

    BelegID=""

      BelegID=mySelections.Item(i).text

  SQL_String=SQL_String & "UPDATE * SET "

  SQL_String=SQL_String & "MatchID = '" & MatchID & "', "

  SQL_String=SQL_String & "MatchUser = '" & MatchUser & "', "

  SQL_String=SQL_String & "MatchTime = '" & MatchTime & "', "

  SQL_String=SQL_String & "MatchComputer = '" & MatchComputer & "', "

  SQL_String=SQL_String & "MatchSaved = 0, "

  SQL_String=SQL_String & "Matched=1 "

  SQL_String=SQL_String & "WHERE BelegID='" & BelegID & "';"

   next

   set mySelections= nothing

  SET Result = ActiveDocument.DynamicUpdateCommand ( SQL_String )

  if Result = false then

  MsgBox "Error: " & Result.ErrorMessage

  end if 

end sub

Anonymous
Not applicable
Author

Hi Matthias, thank you for taking the time to reply.

Maybe my questions were not clear enough. I was asking
1. whether it is possible to INSERT multiple rows with a Dynamic Update INSERT statement

2. and, in case it is possible, the correct syntax for the INSERT statement itself.

It seems to me that, regardless the way the INSERTS statement is built in your first example, it still inserts one single row - I can see a loop only around the VALUES -.

The UPDATE statement had never been an issue and its syntax and use was clear.

I would assume that, since there is a way to update multiple records in one go, there should be a way to INSERT multiple records/rows (not fields) too .

Thank you

Not applicable
Author

Correct me if I'm wrong: Aren't SQL INSERT statements always one by one?

In your case, I would choose the loop of the above posted UPDATE statement and replace the UPDATE with an INSERT.

mayankraoka
Specialist
Specialist

Hi Dix,

Need your inputs.

Did all the setting required for dynamic update mentioned above.Using action button for dynamic.

Working fine on desktop but not from access point?User is present in qlik admin group.

Regards,

Mayank