Subscribe Bookmark RSS Feed

Automation: As many outputs as number of one column variable

saitcopuroglu

Community Trekker

Joined:

Sep 29, 2014

I have a long script (4000 rows) which produces one special report for one hotel and I export it to HTML and  upload it to a website. I produce the same report for 5 different hotels with 5 different scripts. Instead of modifying this script and creating a new script for each hotel (actually have 5), how could I get the result of running one script and taking 5 outputs (each for one hotel). I consider differentiating the data table with a variable column (lets say company code: Hotel1 Hotel2 Hotel3....), coying and pasting the 4000 rows 4 more times would make the output I need. But how should I achieve it (where and how to place that script that every 4000 row script produces a different output?

Or could I give a command to JMP to run the same report as many times as that differentiating columns has variables in it? Hotel1, Hotel2, Hotel3..and it becomes the local data filter for each report?

What would you recommend and how would you solve this automation?

Many thanks in advance

My script starts and ends as:

nw = New Window( "Island Sales Performance Report",

.

.

.

.

.

.

                )

            )

        )

    )

);

nw[Outline Box( "CUMULATIVE REVENUE CURVE" )] << Close( 1 );

nw[Outline Box( "METRICS by MONTH" )] << Close( 1 );

nw[Outline Box( "METRICS by MARKET" )] << Close( 1 );

nw[Outline Box( "METRICS by ROOM TYPE" )] << Close( 1 );

nw[Outline Box( "METRICS by MARKET/MONTH" )] << Close( 1 );

nw[Outline Box( "DAILY PICKUPS" )] << Close( 1 );

nw[Outline Box( "STAY REPORTS" )] << Close( 1 );

nw[Outline Box( "FORECAST" )] << Close( 1 );

nw[Panel Box( 1 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 2 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 3 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 4 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 5 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 6 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 7 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 8 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 9 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 10 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 11 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 12 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 13 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 14 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 15 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 16 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 17 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 18 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 19 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 20 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 21 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 22 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 23 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 24 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 25 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 26 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 27 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 28 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 29 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 30 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 31 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 32 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 33 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 34 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 35 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 36 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 37 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 38 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 39 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 40 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 41 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 42 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 43 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 44 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 45 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 46 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 47 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 48 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 49 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 50 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 51 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 52 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 53 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 54 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 55 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 56 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 57 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 58 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 59 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 60 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 61 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 62 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 63 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 64 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 65 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 66 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 67 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 68 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 69 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 70 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 71 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 72 )][Outline Box( "Local Data Filter" )] << Close( 1 );

nw[Panel Box( 73 )][Outline Box( "Local Data Filter" )] << Close( 1 );

1 ACCEPTED SOLUTION

Accepted Solutions
pmroz

Super User

Joined:

Jun 23, 2011

Solution

You could create a list of hotels and then loop over the list.  Exclude all other hotels, do your analysis, create your report, and then move on to the next hotel.  Something like this:

// Change this to match your table name

dt = data table("Hotel Data Table");

hotel_list = {"Hotel1", "Hotel2", "Hotel3", "Hotel4", "Hotel5"};

for (i = 1, i <= nitems(hotel_list), i++,

     one_hotel = hotel_list[i];

     dt << clear row states;

     hotel_rows = dt << get rows where(as column(dt, "Hotel Name") == one_hotel);

     if (nrows(hotel_rows) > 0,

           dt << select where(column(dt, "Hotel Name") != one_hotel) << exclude << clear select;

     );

// Create the report for each hotel here

     print(one_hotel || ": " || char(nrows(hotel_rows)));

);

dt << clear row states;

4 REPLIES
pmroz

Super User

Joined:

Jun 23, 2011

Solution

You could create a list of hotels and then loop over the list.  Exclude all other hotels, do your analysis, create your report, and then move on to the next hotel.  Something like this:

// Change this to match your table name

dt = data table("Hotel Data Table");

hotel_list = {"Hotel1", "Hotel2", "Hotel3", "Hotel4", "Hotel5"};

for (i = 1, i <= nitems(hotel_list), i++,

     one_hotel = hotel_list[i];

     dt << clear row states;

     hotel_rows = dt << get rows where(as column(dt, "Hotel Name") == one_hotel);

     if (nrows(hotel_rows) > 0,

           dt << select where(column(dt, "Hotel Name") != one_hotel) << exclude << clear select;

     );

// Create the report for each hotel here

     print(one_hotel || ": " || char(nrows(hotel_rows)));

);

dt << clear row states;

saitcopuroglu

Community Trekker

Joined:

Sep 29, 2014

Thank you,

I guess I am unable to implement this script into my main script. Would you be so kind to update my script and highlight the changes if I send the script to your email address? I really would appreciate your help.

pmroz

Super User

Joined:

Jun 23, 2011

Sorry but I don't have time to do that.  Perhaps you could hire a consultant to help you?  There are two that are listed here: http://www.jmp.com/partners/consulting.shtml

Regards,

Peter

saitcopuroglu

Community Trekker

Joined:

Sep 29, 2014

Thank you