Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to close qlikview document in edit script ?

Hi all,

I need to close the qlikview document when some condition exists.

I tried to write a macro just like :

ActiveDocument.ActiveSheet.Close

and called it in the edit script but it didn' t worked.

Is there any way to do this ?

Regards

1 Solution

Accepted Solutions
Not applicable
Author

Hi,

I've attached a workaround.

Hope it may be helpful in your case.

Check in this document the script:

let v = '1';

if Match($(v), '1') then
EXIT Script
ENDIF

//rest of the code
let v = '2';

The macro sub:

sub Close()

vMacro = ActiveDocument.Variables("v").GetContent.String

if vMacro = 1 then
ActiveDocument.GetApplication.Quit
end if

end sub

And the trigger in Settings > Document Properties > Triggers.

OnPostReload > External > Run Macro > Close

Hope this helps you.

View solution in original post

5 Replies
Not applicable
Author

Hi,

Open and  Close the active document

Set Appli=ActiveDocument.GetApplication

Set NewDoc= App.OpenDoc("C:\MyApplication.qvw","","")

ActiveDocument.Active

//Close the document

NewDoc.CloseDoc

I hope it helps U.

~Kabilan K

Not applicable
Author

Hi,

Thanks for your reply,

but still not working,

My code is as following ,

-------------------------------------------------------------------

LOAD A,

     B

FROM

C:\tst.xlsx

(ooxml, embedded labels);

 

//this must be closed

let mTst = fClose(a);

//but still works..

--------------------------------------------------------------------

my script is as :

-------------------------------------------------------------------

function fClose(a)

 

Set Appli=ActiveDocument.GetApplication

Set NewDoc= App.OpenDoc("C:\TTest.qvw","","")

ActiveDocument.Active

'Close the document

NewDoc.CloseDoc

end function

-------------------------------------------------------------------

Maybe I have some sysntax error,

Any Idea ?

Not applicable
Author

Hi,

I've attached a workaround.

Hope it may be helpful in your case.

Check in this document the script:

let v = '1';

if Match($(v), '1') then
EXIT Script
ENDIF

//rest of the code
let v = '2';

The macro sub:

sub Close()

vMacro = ActiveDocument.Variables("v").GetContent.String

if vMacro = 1 then
ActiveDocument.GetApplication.Quit
end if

end sub

And the trigger in Settings > Document Properties > Triggers.

OnPostReload > External > Run Macro > Close

Hope this helps you.

Not applicable
Author

Well, in the end it works!

Thanks jp_bakhache  , that is what I need.

Not applicable
Author

Hi,  sorry for jumping in on this thread.  Im jumping from one document to another using the Open Qlikview Document action..   Is there any way of closing the document I have jumped from after the second document has opened?

Thanks,

Tom