cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
saitcopuroglu
Level IV

Different Data Filters for multiple analysis, possible?

I have a table and producing different graphs but each graph needs to be data filtered differently. What I am experiencing is the first Data Filter won't change and will overwrite the following data filter which means I only can use 1 Data Filter script for multiple reports. Should I write a "clear row states" before each new Dat Filter? The blow example consist of 2 Data Filters but whatever I do the second Data Filter is ignored by JMP, only and always the first one is valid.

Could anyone share his/her experiences/solutions?

Thank you

dt_master = Open( "AccomodationBudget.jmp" );

Open( "AgencyStayREALDATAfin.jmp" );

//Summary REALDATA

Data Table( "AgencyStayREALDATAfin.jmp" ) << Summary(

  Group( :Label, :Month, :Contract, :Room Type ),

  Mean( :RoomDiscount% ),

  Sum( :NetRoomRevenueWithOutVat ),

  Sum( :RoomNight ),

  Sum( :AdultNight ),

  Sum( :BrutRoomRevenue ),

  Sum( :RoomDiscount ),

  statistics column name format( "column" ),

  Link to original data table( 0 )

);

//Concatenate

Data Table( "AccomodationBudget.jmp" ) << Concatenate(

  Data Table( "AgencyStayREALDATAfin By (Label, Month, Contract, Room Type).jmp" ),

  Keep Formulas,

  Append to first table

);

//DATA FILTER 1

Current Data Table() << Data Filter(

  Location( {324, 0} ),

  Mode( Select( 0 ), Include( 1 ) ),

  Add Filter( columns( :Label ), Where( :Label == {"Budget", "2015"} ), Display( :Label, Size( 102, 59 ), Check Box Display ) )

);

//Double Occupancy Performance by Month

Graph Builder(

  Size( 1263, 871 ),

  Show Control Panel( 0 ),

  Legend Position( "Right" ),

  Auto Stretching( 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( :Month ), Y( :RoomNight ), Y( :RoomNight ), Overlay( :Label ) ),

  Elements(

  Position( 1, 1 ),

  Bar( X, Y, Legend( 3 ), Bar Style( "Single" ), Summary Statistic( "Sum" ), Label( "Value" ) ),

  Caption Box( X, Y, Legend( 6 ), Summary Statistic( "Sum" ), X Position( "Right" ), Y Position( "Top" ) )

  ),

  Elements(

  Position( 1, 2 ),

  Bar( X, Y, Legend( 5 ), Bar Style( "Single" ), Summary Statistic( "% of Total" ), Label( "Value" ) ),

  Caption Box( X, Y, Legend( 7 ), Summary Statistic( "% of Total" ), X Position( "Right" ), Y Position( "Top" ) )

  ),

  SendToReport(

  Dispatch( {}, "Graph Builder", OutlineBox, {Set Title( "Room Night Performance by Month [Budget vs 2015]" )} ),

  Dispatch(

  {},

  "Month",

  ScaleBox,

  {Min( -0.5 ), Max( 6.5 ), Inc( 1 ), Minor Ticks( 1 ), Show Minor Grid( 1 ), Inside Ticks( 1 ), Rotated Labels( "Horizontal" )}

  ),

  Dispatch( {}, "RoomNight", ScaleBox, {Show Major Grid( 1 ), Show Minor Grid( 1 ), Inside Ticks( 1 )} ),

  Dispatch(

  {},

  "RoomNight",

  ScaleBox( 2 ),

  {Format( "Percent", Use thousands separator( 0 ), 12, 2 ), Max( 0.4 ), Show Major Grid( 1 ), Show Minor Grid( 1 ), Inside Ticks( 1 )}

  ),

  Dispatch(

  {},

  "400",

  ScaleBox,

  {Legend Model(

  3,

  Properties( 0, {Line Color( -4222675 ), Fill Color( -4222675 )} ),

  Properties( 1, {Line Color( -13647958 ), Fill Color( -13647958 )} ),

  Properties( 2, {Line Color( -2994485 ), Fill Color( -2994485 )} )

  )}

  ),

  Dispatch( {}, "graph title", TextEditBox, {Set Text( "" )} ),

  Dispatch( {}, "Y title", TextEditBox, {Set Text( "" )} ),

  Dispatch( {}, "", AxisBox( 2 ), {Add Axis Label( "RoomNight Sum by Month" ), Add Axis Label( "Ay Bazinda Toplam Gece Konaklama " )} ),

  Dispatch( {}, "Graph Builder", FrameBox, {Left( 1 ), Right( 1 ), Top( 1 ), Bottom( 1 )} ),

  Dispatch( {}, "Y 1 title", TextEditBox, {Set Text( "% of Total RoomNight By Month" )} ),

  Dispatch( {}, "", AxisBox( 3 ), {Add Axis Label( "Ay Bazinda Toplam Gece Konaklama Yüzdesel Dagilimi" )} ),

  Dispatch(

  {},

  "Ay Bazinda Toplam Gece Konaklama Yüzdesel Dagilimi",

  TextEditBox,

  {Set Text( "Ay Bazinda Gece Konaklama Yüzdesel Dagilimi" )}

  )

  )

);

//DATA FILTER 2

Current Data Table() << Data Filter(

  Location( {437, 0} ),

  Mode( Select( 0 ), Include( 1 ) ),

  Add Filter( columns( :Label ), Where( :Label == {"Budget", "2015", "2014"} ), Display( :Label, Size( 102, 59 ), Check Box Display ) )

);

//Double Occupancy Performance by Market Code

Graph Builder(

  Size( 1263, 629 ),

  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( :Contract ), Y( :DoubleOcc ), Overlay( :Label ) ),

  Elements( Bar( X, Y, Legend( 2 ), Bar Style( "Single" ), Summary Statistic( "Mean" ), Label( "Value" ) ) ),

  SendToReport(

  Dispatch( {}, "Contract", ScaleBox, {Show Minor Grid( 1 ), Inside Ticks( 1 )} ),

  Dispatch(

  {},

  "DoubleOcc",

  ScaleBox,

  {Min( 1.39439277722467 ), Max( 2.4 ), Inc( 0.2 ), Minor Ticks( 1 ), Show Major Grid( 1 ), Show Minor Grid( 1 ), Inside Ticks( 1 )}

  )

  )

);

1 ACCEPTED SOLUTION

Accepted Solutions
pmroz
Super User

Re: Different Data Filters for multiple analysis, possible?

Here's an example using Big Class with two graphs, two local data filters:

dt = Open( "$sample_data\Big Class.jmp" );

nw = New Window( "Example with 2 Different Data Filters",

     Panel Box( "Age Filter",

        gb1 = Graph Builder(

            Show Control Panel( 0 ),

            Variables( X( :weight ), Y( :height ), Overlay( :sex ) ),

            Elements( Points( X, Y, Legend( 1 ), Jitter( 1 ) ) ),

            Local Data Filter(

Location( {986, 266} ),

Mode( Select( 0 ), Show( 1 ), Include( 1 ) ),

Add Filter( columns( :age ), Where( :age == {12, 13, 14} ) )

            )

        ),

    ),

     Panel Box( "Sex Filter",

        Graph Builder(

            Show Control Panel( 0 ),

            Variables( X( :weight ), Y( :height ), Overlay( :sex ) ),

            Elements( Points( X, Y, Legend( 1 ), Jitter( 1 ) ) ),

            Local Data Filter(

Location( {93, 158} ),

Mode( Select( 0 ), Show( 1 ), Include( 1 ) ),

Add Filter( columns( :sex ), Where( :sex == "M" ) )

            )

        ),

    )

);

View solution in original post

10 REPLIES 10
pmroz
Super User

Re: Different Data Filters for multiple analysis, possible?

You can use a local data filter with each graph and it will not affect the other graphs.

saitcopuroglu
Level IV

Re: Different Data Filters for multiple analysis, possible?

Thank you PMroz but it is not a solution for me hence I export the reports to Interactive HTML for publishing, the local data filter is a non-functioning ugly picture in case of Interactive HTML reports.

pmroz
Super User

Re: Different Data Filters for multiple analysis, possible?

Here's an example using Big Class with two graphs, two local data filters:

dt = Open( "$sample_data\Big Class.jmp" );

nw = New Window( "Example with 2 Different Data Filters",

     Panel Box( "Age Filter",

        gb1 = Graph Builder(

            Show Control Panel( 0 ),

            Variables( X( :weight ), Y( :height ), Overlay( :sex ) ),

            Elements( Points( X, Y, Legend( 1 ), Jitter( 1 ) ) ),

            Local Data Filter(

Location( {986, 266} ),

Mode( Select( 0 ), Show( 1 ), Include( 1 ) ),

Add Filter( columns( :age ), Where( :age == {12, 13, 14} ) )

            )

        ),

    ),

     Panel Box( "Sex Filter",

        Graph Builder(

            Show Control Panel( 0 ),

            Variables( X( :weight ), Y( :height ), Overlay( :sex ) ),

            Elements( Points( X, Y, Legend( 1 ), Jitter( 1 ) ) ),

            Local Data Filter(

Location( {93, 158} ),

Mode( Select( 0 ), Show( 1 ), Include( 1 ) ),

Add Filter( columns( :sex ), Where( :sex == "M" ) )

            )

        ),

    )

);

saitcopuroglu
Level IV

Re: Different Data Filters for multiple analysis, possible?

Thank you, the result does not seem to be likely to share with whole management of the company in case of Interactive HTML, the filter is not functioning and sets it to be meaningless to share;

http://bpmreports.businesscatalyst.com/agencystay.htm

8079_Screen Shot 2015-02-23 at 18.41.30.png

saitcopuroglu
Level IV

Re: Different Data Filters for multiple analysis, possible?

What I discovered right now is; If you create a new window and pack all the graphs in it, collapsing local data filter will not take effect with Interactive HTML output (it will be visible beside being non-functional), however if you create a Panel Box for each graph -as with your example above- and pack each graph in a separate Panel Box and collapse the local data filter it won't show up by the .html output which solved my problems.

Many thanks!

saitcopuroglu
Level IV

Re: Different Data Filters for multiple analysis, possible?

Is there a script for collapsing/hiding the local data filter? That would minimise my workflow time.

ms
Super User (Alumni) ms
Super User (Alumni)

Re: Different Data Filters for multiple analysis, possible?

In PMroz example the first two commands close the local datafilters whereas the last two delete them (the local filter settings seem to remain but I have not testet all scenarios...):

nw[Panelbox(1)][outlinebox("Local Data Filter")]<<close(1);

nw[Panelbox(2)][outlinebox("Local Data Filter")]<<close(1);


nw[Panelbox(1)][outlinebox("Local Data Filter")]<<delete;

nw[Panelbox(2)][outlinebox("Local Data Filter")]<<delete;

saitcopuroglu
Level IV

Re: Different Data Filters for multiple analysis, possible?

Thank you Michael,

I am sorry but I am a newbie, would you be so kind to inject the scripts in PMroz's "Example with 2 Different Data Filters" script?

ms
Super User (Alumni) ms
Super User (Alumni)

Re: Different Data Filters for multiple analysis, possible?

The code assumes there is a report called nw (the New Window(...) in PMroz script) that contains at least two panel boxes.

It does not need to be inserted. Run PMroz code to create the report then run any of the four commands in my post to see and learn about the effect. If you like it, adapt it to your code.