Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Variable true if activated object

Good day!

During several days i'm working at task of getting dynamically info about activated objects in QV 11.

As audit logging files don't give us any info about opened object, my idea is:

1. Create for each object one variable.

2. Set to this variable value 1 if object is active

3. Set the trigger for that variable OnChange Value: run macro (which will write info about active object to some txt file) if value in variable is changed (1 - active object, 0 - not active object)

Have anyone ideas how to implement step 2 (Set to this variable value 1 if object is active) ?

Maybe, someone has other way to solve this task (too much people try to solve similar task , if you know...)))

Welcome

4 Replies
marcus_sommer

Have a look on these snippet from APIGuide.qvw (is in your qv install-folder):

rem ** minimize all active sheet objects on active sheet **

set s=ActiveDocument.ActiveSheet

objs=s.GetSheetObjects

for i=lbound(objs) to ubound(objs)

    if objs(i).IsActive then objs(i).Minimize

next

Instead of minimize you could read the name, id, timestamp, user .... But I wouldn't create a variable for each object I would rather use one variable as logfile and append each new event as a new row. These variable could you write by closing the app or externally in a text-file. Then to scan each movement within the app is quite heavy but to write it immediately is more difficult - from performance point of view and if several users used the same app at the same time ...

- Marcus

Anonymous
Not applicable
Author

Thank you!

I'm not strong in VBS script code. Could you give me some links with function which got name, id, timestamp, user and others?

Thank you!

Anonymous
Not applicable
Author

and for second:

for which event i must connect Macro to check activated objects dynamically ? (in QV there're only Document,Field event and Variable event triggers.)

marcus_sommer

All these things could you easily find within the APIGuide.qvw in the sheets "A... Members" and "A... Examples".

User:

set temp = ActiveDocument.GetApplication.GetProperties

msgbox(temp.UserName)

ObjectID:

rem ** get unique object ID for first object on sheet Main **

set s = ActiveDocument.Sheets("Main")

set so = s.SheetObjects(0)

id = so.GetObjectId

msgbox("ID = " & id)

Timestamp:

= now()

- Marcus