Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
yacine_b
Contributor III
Contributor III

drop tables

Hi,

I need to create a qlikview application wich can do the following things :

1/ load a script

2/ execute a macro when script loading is complete (document properties -> ....)

3/ drop all tables (wich are loades in the script)

I did step (1) et (2) successfully,

could you please help me do the (3) plzzz

1 Solution

Accepted Solutions
Miguel_Angel_Baeyens

Hello,

I don't think it's possible at least in version 9. You can remove all data (records) existing in the document with

ActiveDocument.RemoveAllData


but I don't think macros can delete tables (structure).

Regards.

View solution in original post

6 Replies
Miguel_Angel_Baeyens

Hello,

You can use the following code

FOR i = 0 TO NoOfTables() - 1 LET vTableDropped = TableName(0); DROP TABLES $(vTableDropped);NEXT


Whis will leave the document empty (no tables and no records), I'm not sure if that's what you want, though. Take care if you are using this code with section access, you will lock yourself out.

Hope this helps

yacine_b
Contributor III
Contributor III
Author

thank you Miguel but that's not exactly what I want. I think that I should drop tables using macro, not in script. what do you think about it?

Miguel_Angel_Baeyens

Hello,

I don't think it's possible at least in version 9. You can remove all data (records) existing in the document with

ActiveDocument.RemoveAllData


but I don't think macros can delete tables (structure).

Regards.

yacine_b
Contributor III
Contributor III
Author

thank you for your answer, it helps me ^^

I used the "ActiveDocument.RemoveAllData" in the macro, but when I reload the application (by qv.exe /r), I get a save file dialog. I dont like get this dialog :s

Not applicable

do you still get the save dialog if you use

ActiveDocument.GetApplication.Quit

in the macro?

yacine_b
Contributor III
Contributor III
Author

Hi,

I found a better solution.

you can create a macro like this:

ActiveDocument.Variables("IsItAMacroLunch").SetContent "YES",true
ActiveDocument.Reload
ActiveDocument.Variables("IsItAMacroLunch").SetContent "NO",true
Dont forget to add the variable "IsItAMacroLunch" and give it "NO" as value.
then, add in the script the following instructions:
IF '$(IsItAMacroLunch)'='YES' THEN
//nothing here
ELSE
// Your old script.
ENDIF