Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have a dashboard which has a document macro sets Year = Current Year when Current Selections are 0 or when Clear is selected.
I am adding a new tab to this document where I do not want this to apply. Is there a way to make one tab immune to this document macro so that current year is not set even when current selections are zero? The code for the macro is given below in Bold
If the above is not possible, then is it possible to have a default filter set on the tab when Clear is clicked (or all filters are removed).
I have a column called CountID. So setting CountID = No_Count (by setting this in sheet properties) when all filters are removed will prevent the occurrence of an empty Current Selections state and will not trigger the macro, thus solving my problem.
'Set filter values when the Clear Button or All Filters are removed.
sub AfterClear()
if activedocument.evaluate("len(getcurrentselections())")=0 then
'Sets the Year to the Current Year
activedocument.fields("YearName").select GetVariable("vCurrentYear")
' 'The Year_List is not attached to anything. This will just be a placeholder so that you can remove the selected object above
' ' Without setting the "len(getcurrentselections())")=0
' activedocument.fields("Year_List").select GetVariable("vCurrentYear")
end if
end sub
Thanks for your help on this.
Amitesh
Got this resolved. One of my colleagues came up with the idea of adding the following to the code given below in Bold
if activedocument.evaluate("len(getcurrentselections())")=0 and activedocument.evaluate("getactivesheetid()") <> "Document\SHXX" then
where "SHXX" is the target Sheet ID
Hope this helps someone with this kind of issue in future.
P.S.: When doing some thing like you have to ensure that sheet properties are set properly
I had, on the Triggers tab
OnActivateSheet: Actions -> Clear All
OnLeaveSheet: Actions -> Select in Field (Year=$(vCurrentYear)
as intended behavior for other sheets (tabs) is to be filtered on current Year by default.
Got this resolved. One of my colleagues came up with the idea of adding the following to the code given below in Bold
if activedocument.evaluate("len(getcurrentselections())")=0 and activedocument.evaluate("getactivesheetid()") <> "Document\SHXX" then
where "SHXX" is the target Sheet ID
Hope this helps someone with this kind of issue in future.
P.S.: When doing some thing like you have to ensure that sheet properties are set properly
I had, on the Triggers tab
OnActivateSheet: Actions -> Clear All
OnLeaveSheet: Actions -> Select in Field (Year=$(vCurrentYear)
as intended behavior for other sheets (tabs) is to be filtered on current Year by default.