Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

QlikWorld 2020: Join us May 11 - 14, 2020 in Phoenix, AZ. Register early and save $400. Learn More
New Contributor III

DynamicUpdateCommand stops working after QV restart

Hello, I'm using DynamicUpdateCommand inside a macro in this way:

sub addOrder

  set choosen = ActiveDocument.Fields("NUMORD").GetPossibleValues

  for i = 0 to choosen.Count - 1

    set result = ActiveDocument.DynamicUpdateCommand("UPDATE * SET CHOOSE = 'S' WHERE NUMORD = '" & choosen.Item(i).text & "' " )

    if result = false then

      MsgBox result.ErrorMessage

    end if 


end sub

Dinamic Data Update is enabled.

It works, but, when I close QlikView and reopen it, it doesn't work anymore. Reloading doesn't affect it.

I empirically realized that to make it work again I need to change something in the UPDATE, for example turning the '*' into 'MYTABLE'.

I can I solve this weird issue? Maybe is it connected with RAM and way of saving .qvw to the file system?

Many thanks!

1 Reply
New Contributor III

Re: DynamicUpdateCommand stops working after QV restart

I worked more on it and I realized that to make DynamicUpdateCommand work again I only need to save the document (Ctrl+S)... I don't know why!

I'm doing it programmatically on document opening, with this workaround:

  • Document Properties... > Triggers > Document Event Triggers > OnOpen > Add Action(s)... > Add > External > Run macro > set Macro name = reactivateDynamicUpdateCommand
  • Tools > Edit Module...: add this subroutine:

sub reactivateDynamicUpdateCommand

     ' I know, it's weird

     '... but needed to reactivate DynamicUpdateCommand functionality after a restart


end sub

It works, even if a better solution would be appreciated. Thanks!