I have a long script producing a final output. I would like to use one scripting window (the same scripting window), running the script producing multiple outputs with the difference of local filters. To explain better; I have data tables for a hotel chain daily accomodation income, the Companycode column is the differentiationg column. Till now I prepared 1 script for each hotel so I need to run 3 scripts for 3 reports and the time consuming thing is, if I would like to change a graph I need to do it 3 times (for each hotel) and mostly it is also error.-proning.I asked the IT to create a column of "CompanyCode" and unified all 3 hotell's data into one single data table. I prepared 1 script of revenue reports and would like to run that script once and it produces 3 outputs each for one hotel. How will I do that?
I tried copying the whole script in the same window seperated by a ";" but did not help
Modularising code so it is easier to maintain and can be easily reused is part of the art of programming in any language. As you get more used to JMP, JSL, and the way they interact, this generally becomes easier to do.
If I understand correctly, you already have a script ('myScript') that does what you want for data from one hotel in a table, but you now have a new table containing data for three hotels ('A', 'B' and 'C'), and there is an additional column ('Companycode') that tells the hotels apart.
If 'myScript' only generates a series of reports, you should use the 'By variable' that is found in each platform launch dialog. For instance, if you have a line like:
changing it to:
FitYbyX(X(:x), Y(:y), By(:Companycode))
will give an outline node in the report for each distinct value or level contained in the column 'Companycode' (in your case, each of the three hotels).
If 'myScript' has a lot of custom code which you don't feel inclined to change, consider a loop that makes a new table with just the subset of data for each hotel, then call 'myScript'.