Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi to all,
today I have another question: How can I move a number of variables by a button? With my knowledge I can add Actions to the button, but I have to move 12 variables.... (eg. vVar1 --> vVar0, vVar2 --> vVar1, vVar3 --> vVar2, vVar4 --> vVar3, etc...)
Is there a quicker way to do that? Can i do that by a macro? How could I get the variables in the macro?
thanks & best regards,
Stefan
Stefan,
Actions should be far more efficent than macros which result in the purging of caches and so on, so should always be used in preference.
But.....
As actions are all fired at the same time (if only Qliktech would clarify this!) it is possible that any new value of the variable will not be in place before it is moved elsewhere (for example vVar2 could be either its current value or have become that of vVar3) I think you should use a macro instead, like this:
set doc=ActiveDocument
Var1 = doc.Variables("vVar1").GetContent.String
doc.Variables("vVar0").SetContent Var1, false
Regards,
Gordon
hi gordon,
thanks for your help. I'm trying to make it with a macro. But I got two problems. Perhaps you can assist another time?
1) If I code following statement...
Sub NewMonth
ActiveDocument.Sheets("Basis").Activate
set doc=ActiveDocument
vDatum0 = doc.Variables("vDatum0").GetContent.String
vTask0 = doc.Variables("vTask0").GetContent.String
vVers0 = doc.Variables("vVers0").GetContent.String
vDatum1 = doc.Variables("vDatum1").GetContent.String
vTask1 = doc.Variables("vTask1").GetContent.String
vVers1 = doc.Variables("vVers1").GetContent.String
...
end sub
...my Debugger won't start. If I do some Dummy Variables like ....
sub NeuerMonat
ActiveDocument.Sheets("Basis").Activate
set doc=ActiveDocument
set dummy1 = 1
set dummy2 =2
vDatum0 = doc.Variables("vDatum0").GetContent.String
vTask0 = doc.Variables("vTask0").GetContent.String
vVers0 = doc.Variables("vVers0").GetContent.String
vDatum1 = doc.Variables("vDatum1").GetContent.String
vTask1 = doc.Variables("vTask1").GetContent.String
vVers1 = doc.Variables("vVers1").GetContent.String
...
end sub
... now my Debugger starts, and I get a Message "Objekt erforderlich: '[string: "1"]' . What did I make wrong?
2)
If I add the Macro 'NeuerMonat' to my Button and press the Button, the Macro-editor opens. The Macro did'nt start, even the debugger runs without any error.
do you or someone else have any ideas? I'm using QlikView 9.00.7469.8 SR4
many thanks & best regards
Stefan
Hi Stefan,
I do not undertsand in 1) where you say the debugger wont start? Are you putting breakpoints on the lines of code or something? If its just running without any displays that probably means its running ok.
in 2) - you cannot use SET for a variable (set is a container for objects/properties). To set a local variable in VBS you just say
dummy1 = 1
Regards,
Gordon
Hi Gordon,
thanks for answering. While the debugger hasn't start, I didn't tried my macro at runtime. But what should I say.... It works....
I do not undertsand in 1) where you say the debugger wont start? Are you putting breakpoints on the lines of code or something? If its just running without any displays that probably means its running ok.
Normaly I should run my macro step by step in debugging mode, even if there is no error. But I didnt could do this if I have no dummies...
Anyway, I deleted the two dummies and have runned my macro without debuggung... it works fine. Thousand thanks for your help.
best regards
Stefan