Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Open Qlikview Document action

Hi all,

Just upgraded to v9sr4 from v8.20 and going through the snag list....

I use a technique to pass parameters to invoke another document from a button where the code typically looks like:

sub CallMachMan
' Invoke Machine Management document

Set doc = ActiveDocument

PassPars = "?SheetName=SUZI List"

' If only one depot currently selected then default Machine Management to this value
set DefDep = doc.Fields("Depot No").GetPossibleValues
If DefDep.Count = 1 then
PassPars = PassPars & "&DepotNo=" & DefDep.Item(0).Text
End if

Set b = doc.GetSheetObject("BU05")
Set bp = b.GetProperties
bp.Application.v = "C:\Program Files\Internet Explorer\IEXPLORE.EXE"
bp.Parameters.v = "qvp://gbduxn015/QVWarranty/MACHINE MANAGEMENT.QVW" & PassPars

b.SetProperties bp

b.Press

end sub

Both 'SheetName' and 'DepotNo' are variables declared in the document 'Machine Management' with OnChange triggers attached to them to activate the relevant sheet and select the passed depot number.

This doesnt work in v9sr4 as the button object doesnt support 'application'.

I can see that using 'Open Qlikview document' I can 'apply state on top of current' but how can I force an active sheet?

Regards,

Gordon

4 Replies
Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

Gordon,

as "work around"... I'd try converting the passed parameters into hidden fields with Selections (because Selection state can be passed into the opened document, and then create a set of Actions "On Open" that would test the selected Field Values and open the appropriate Sheet.

When I first switched from Macros (8.5) to Actions (9.00), my first struggle was the lack of the conditional statement IF... THEN ... ELSE...

Again, as a work around, I'm using Variables and conditional function IF () instead - I set a variable using IF() and then use the variable to do something like opening a specific sheet, or enabling objects, etc...

With all the differences and missing functions, I found that, overall, using Actions instead of Macros (when possible) is refreshingly easy and trouble-free...

cheers!

Not applicable
Author

Aha! That makes great sense!

Thanks Oleg!

Gordon

Not applicable
Author

Oleg,

I have tried using the principles you described, but have run into a smaller problem, which you may or may not have experienced.

In both the original and the destination QV document I have created a field names Transfer. When the action in the original document is executed it selects the value of 1 ind the Transfer field. The Transfer field in the destination document obtains the selection. So far all is good.

When trying to use field event triggers on change of the Field Transfer or a logially associated field, with the action of selecting sheet SH05, nothing happens. It's like the program doesn't register the change, when the document is opened. If I manualy change the selection in the Transfer field, the action, the selection of sheet SH05, is performed.

So I turned to your next suggestion of using variables. I created the variable vTransfer i the destination document, with this formula:
=if(GetFieldSelections([Transfer])=1,1,0)

So when the selection is transfered, the Variable turns to 1 - otherwise 0. Made a variable trigger OnChange to activate SH05.

And it worked!
But the problem is, that whenever all selections are cleared, it triggers the variable OnChange, and activates SH05, which is quite unsuitable.

Any ideas?

Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

Hmm, I'd think along the lines of involving another variable, that could hold the "status" - once the document is open and sheet SH05 is activated, mthe second variable can be set to a value meaning "No More".