Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to activate a sheet in an object extension?

Through macros you can invoke ActivateSheetById to switch sheets but how do invoke this or similar function to switch sheets in a object extension?

1 Solution

Accepted Solutions
Alexander_Thor
Employee
Employee

Hey Mike,

You can't invoke any methods from the Automation API from the JS API.

On to your original question,

There is a few different ways to approach this, I would opt to use a simple solution and just supply a sheet parameter to the url.

So invoking something like this from within your extension will refresh the page and direct the user to the correct sheet.

var sheetId = 'SH01'

window.location = window.location.href + '&sheet=' + sheetId;

You want to build some logic around handling already existing parameters in the url though.

You could also do something like this which would be running the same internal function as standard QV.

It's not part of the official API so if we decided to re-build the way we handle tab changes it would break.

Qv.GetCurrentDocument().binder.Set("Document.TabRow.Document\\SH27", "action", "", true)

View solution in original post

4 Replies
Sokkorn
Master
Master

Hi Mike,

You may refer to this extension.

Regards,

Sokkorn

Not applicable
Author

Thank you but this is a document extension that uses SetTabrowPaint. I'm not sure if or how you would translate this into an object extension. While I'm currently trying to invoke something like the ActivateSheetById method, I'd be curious to know if you could (and how) invoke any of the QV Automation Interface methods within extensions (currently an object extension).  Thanks again.

Alexander_Thor
Employee
Employee

Hey Mike,

You can't invoke any methods from the Automation API from the JS API.

On to your original question,

There is a few different ways to approach this, I would opt to use a simple solution and just supply a sheet parameter to the url.

So invoking something like this from within your extension will refresh the page and direct the user to the correct sheet.

var sheetId = 'SH01'

window.location = window.location.href + '&sheet=' + sheetId;

You want to build some logic around handling already existing parameters in the url though.

You could also do something like this which would be running the same internal function as standard QV.

It's not part of the official API so if we decided to re-build the way we handle tab changes it would break.

Qv.GetCurrentDocument().binder.Set("Document.TabRow.Document\\SH27", "action", "", true)

Not applicable
Author

Thanks Alexander,

I was afraid that was the answer about the Automation APIs from JS API but I was hoping I was wrong.

Also thank you for your ideas. I will look into them. I had got it working by setting a QV variable through the JS API which had a trigger on it so whenever the variable changed it would change the sheet to the value of the variable.

Thank you!