Hi,
what is the best way to get the scriptable object of the current report?
If it's a Graph Builder Object, I can use
gb = Current Report()["Graph Builder"] << get scriptable object
This is astonishingly robust - but just works for Graph Builder objects. It even works when the user changed the title.
If it no Graph Builder, I can try
so = Current Report()[Outline Box( 1 )] << get scriptable object
It will work if there is no Local Data Filter,
no Column Switcher [ah, Column Switcher is a ColumnSwitcherContextOutlineBox, no OutlineBox]
and no user define Dashboard [ah, the Dashboard is created via TabPageBoxes, not OutlineBoxes]
For the case with the Local Data Filter, I could check the title:
ob = Current Report()[Outline Box( 1 )];
If( (ob << Get Title) == "Local Data Filter",
ob = Current Report()[Outline Box( 2 )]
);
ob << get scriptable object;
This approach works only with English language setting and just if the user didn't change the title of the OutlineBox.
So, better check if the scriptable object if it is a data filter:
Try (so = Current Report()[Outline Box( 1 )] << get scriptable object;
if (Char(Head(so)) == "Data Filter[]" ,
so = Current Report()[Outline Box( 2 )] << Get Scriptable Object),
Caption("failed to get a scriptable object") // user defined Dashboard
)