- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Script for dynamic date/time axising
I need to reproduce a report every day and the x axis date/time variable should show only the last seven days, and same goes for tabulate and etc... Is there a way to tell JMP by a script?
Thank you all in advance
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Script for dynamic date/time axising
The Min( 3505939200 ), Max( 3510000000 ) forces the axis to hose limits. Try to delete the entire Send to report(...) part.
Or change it into something like:
Min(today()-in days(7)), Max(today())
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Script for dynamic date/time axising
There are multiple ways, as usual, to do it by script. One approach is to hide and exclude the "too old" data table rows.
dt = Current Data Table();
dt << select where(:Name("Date/Time") < Today() - In Days(7));
dt << hide and exclude << clear select;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Script for dynamic date/time axising
Thank you.
Even the Data is not displayed, the time axis still displays the hidden/excluded rows.
I actually need both not to be displayed. Does the same script go for the x axis display?
dt = Current Data Table();
dt << select where(:Name("SalesDate") < Today() - In Days(7));
dt << hide and exclude << clear select;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Script for dynamic date/time axising
Graph Builder usually adapts the axes automatically to show the range of included data only. Are you sure you haven't hard coded the x-axis limits? Check the graph builder script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Script for dynamic date/time axising
"Hard-Coding x-axis limits"? I am afraid I am unaware of that term.
Graph Builder(
Show Control Panel( 0 ),
Title Fill Color( "Light Blue" ),
Title Frame Color( "Medium Dark Gray" ),
Level Fill Color( {174, 203, 228} ),
Level Frame Color( "Medium Dark Gray" ),
Level Underline( 1 ),
Variables( X( :SalesDate ), Y( :NetRevenue ) ),
Elements(
Points( X, Y, Legend( 1 ), Jitter( 1 ) ),
Smoother( X, Y, Legend( 2 ) )
),
SendToReport(
Dispatch(
{},
"SalesDate",
ScaleBox,
{Min( 3505939200 ), Max( 3510000000 ), Interval( "Day" ), Inc( 1 ),
Minor Ticks( 0 ), Show Major Grid( 1 ), Inside Ticks( 1 ),
Rotated Labels( "Vertical" )}
)
)
)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Script for dynamic date/time axising
The Min( 3505939200 ), Max( 3510000000 ) forces the axis to hose limits. Try to delete the entire Send to report(...) part.
Or change it into something like:
Min(today()-in days(7)), Max(today())
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Script for dynamic date/time axising
Deleting the entire Send To( did not but rewriting the min-max helped.
Thank you a lot!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Script for dynamic date/time axising
Hi again,
Would you please keep helping by;
Dynamic date/time scripting for tabulate?
I am okay with graph builder but need to do it also within tabulate local data filter:
I tried to do something like you did with graph builder
Local Data Filter(
Location( {56, 0} ),
Mode( Select( 0 ), Show( 1 ), Include( 1 ) ),
Add Filter(
columns( :SalesDate ),
Where( :SalesDate >= 20Feb2015 & :SalesDate < 14Mar2015 ),
Display( :SalesDate )
)
to something like this but it does not work.
Local Data Filter(
Location( {34, 0} ),
Mode( Select( 0 ), Show( 1 ), Include( 1 ) ),
Add Filter(
columns( :SalesDate ),
Where(:Name("SalesDate") < Today() - In Days(7)),
Display( :SalesDate )
)
Thank you for your help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Script for dynamic date/time axising
It should work fine if you add the missing ")".
tb = Tabulate(...);
tb << Local Data Filter(
Add Filter(
columns(:SalesDate),
Where(:Name("SalesDate") < Today() - In Days(7)),
Display(:SalesDate)
)
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Script for dynamic date/time axising
Thanks MS. This is what I'm looking for for my work as well