Hi,
I have a JMP table "Sheet 1" with 300 columns. I am trying to create subset for all same columns which has a string in column name as "Ahu1" and then make changes to those subset like adding the columns,updating them and generating graphs and finally saving them in a folder. I was able to write script for "Ahu1". But i have to do the same for all other "Ahu's" . I want this process to be repeated for other column names containing stings: which are Ahu2,Ahu3,Ahu4,Ahu5,Ahu6...Ahu52. How to do this in a for loop?
The Script is below.
original_dt = Current Data Table();
Data Table( "Sheet1" ) << Subset(
Output Table( "Ahu1", link to original data table( 0 ) ),
All rows,
columns(
:Timestamp,
:donSteedOccupancy,
:Name( "Raeford, NC Temp" ),
:DonSteedES Ahu1 ClgVlvCmd,
:DonSteedES Ahu1 HtgVlvCmd,
:DonSteedES Ahu1 DaT,
:DonSteedES Ahu1 SaFanCmd,
:DonSteedES Ahu1 ZnT,
:DonSteedES Ahu1 ZnTStpt
)
);
Ahu1_dt = Data Table( "Ahu1" );
Ahu1_dt << New Column( "Occupancy",
character,
Nominal,
Formula( Munger( :donSteedOccupancy, Length( :donSteedOccupancy ) - 4, Length( :donSteedOccupancy ) ) )
);
Column( "Occupancy" ) << delete formula;
Ahu1_dt << delete columns( "donSteedOccupancy" );
Ahu1_dt << New Column( "SaFanCmd",
character,
Nominal,
Formula(
Munger(
:DonSteedES Ahu1 SaFanCmd,
Length( :DonSteedES Ahu1 SaFanCmd ) - 4,
Length( :DonSteedES Ahu1 SaFanCmd )
)
)
);
Column( "SaFanCmd" ) << delete formula;
Ahu1_dt << delete columns( "DonSteedES Ahu1 SaFanCmd" );
Ahu1_dt << Column( "Occupancy" );
For Each Row( :Occupancy = Match( :Occupancy, " 1min", " 1", " 0min", " 0", :Occupancy ) );
Column( "Occupancy" ) << Data type( character ) << Set Data Type( Numeric );
Ahu1_dt << Column( "SaFanCmd" );
For Each Row( :SaFanCmd = Match( :SaFanCmd, " 1min", " 1", " 0min", " 0", :SaFanCmd ) );
Column( "SaFanCmd" ) << Data type( character ) << Set Data Type( Numeric );
Ahu1_dt:DonSteedES Ahu1 ClgVlvCmd << Format( "percent" );
Ahu1_dt:DonSteedES Ahu1 HtgVlvCmd << Format( "percent" );
Column( "SaFanCmd" ) << Modeling type( continuous );
optstartgraph = Ahu1_dt << Graph Builder(
Size( 1377, 923 ),
Variables(
X( :Timestamp ),
Y( :DonSteedES Ahu1 ClgVlvCmd ),
Y( :DonSteedES Ahu1 HtgVlvCmd, Position( 1 ) ),
Y( :Name( "Raeford, NC Temp" ) ),
Y( :DonSteedES Ahu1 DaT, Position( 2 ) ),
Y( :DonSteedES Ahu1 ZnT, Position( 2 ) ),
Y( :DonSteedES Ahu1 ZnTStpt, Position( 2 ) ),
Y( :SaFanCmd, Position( 2 ), Side( "Right" ) ),
Color( :Occupancy )
),
Elements( Position( 1, 1 ), Line( X, Y( 1 ), Y( 2 ), Color( 0 ), Legend( 5 ) ), Heatmap( X, Legend( 8 ) ) ),
Elements(
Position( 1, 2 ),
Line( X, Y( 1 ), Y( 2 ), Y( 3 ), Y( 4 ), Color( 0 ), Legend( 6 ) ),
Line( X, Y( 5 ), Color( 0 ), Legend( 7 ) ),
Heatmap( X, Legend( 9 ) )
),
SendToReport(
Dispatch( {"Line[DonSteedES Ahu1 ClgVlvCmd...]"}, "", OutlineBox, {Close( 0 )} ),
Dispatch( {"Heatmap[DonSteedES Ahu1 ClgVlvCmd...]"}, "", OutlineBox, {Close( 0 )} ),
Dispatch( {"Line[Raeford, NC Temp...]"}, "", OutlineBox, {Close( 0 )} ),
Dispatch( {"Line[SaFanCmd] (right)"}, "", OutlineBox, {Close( 0 )} ),
Dispatch( {"Heatmap[Raeford, NC Temp...]"}, "", OutlineBox, {Close( 0 )} ),
Dispatch(
{},
"Timestamp",
ScaleBox,
{Min( 3537633600 ), Max( 3538263600 ), Interval( "Hour" ), Inc( 1 ), Minor Ticks( 0 ),
Label Row( Label Orientation( "Angled" ) )}
),
Dispatch( {}, "DonSteedES Ahu1 ClgVlvCmd", ScaleBox, {Min( 0 )} ),
Dispatch(
{},
"400",
ScaleBox,
{Legend Model(
8,
Properties(
0,
{Transparency( 0.35 ), gradient(
{Color Theme(
{"mine", 16387, {{79, 16, 79}, {119, 0, 119}, {42, 63, 255}, {0, 170, 170}, {0, 227,
0}, {221, 221, 0}, {238, 119, 0}, {252, 11, 11}, {158, 33, 33}}, {0,
0.193732193732194, 0.2, 0.495726495726496, 0.501424501424502, 0.507122507122507,
0.943019943019943, 0.95, 0.954415954415954}}
)}
)}
)
), Legend Model(
9,
Properties(
0,
{Transparency( 0.35 ), gradient(
{Color Theme(
{"mine", 16387, {{79, 16, 79}, {119, 0, 119}, {42, 63, 255}, {0, 170, 170}, {0, 227,
0}, {221, 221, 0}, {238, 119, 0}, {252, 11, 11}, {158, 33, 33}}, {0,
0.193732193732194, 0.2, 0.495726495726496, 0.501424501424502, 0.507122507122507,
0.943019943019943, 0.95, 0.954415954415954}}
)}
)}
)
)}
),
Dispatch(
{},
"400",
LegendBox,
{Legend Position( {5, [0, 1], 8, [2], 6, [-3, -3, 4, 5], 7, [-3], 9, [3]} ),
Position( {0, 1, 2, -3, -3, 4, 5, -3, 3} )}
)
)
);
optstartgraph << Save Picture( "C:\Projects\Projects\Hoke\Year 1\Jmp\Year 0\DonSteed\Feb16\Ahu1.jpg", "JPG" );
optstartgraph << close window;
Please help me out.
Thanks.