Hi. I'm hoping that this is just a fluke on my part.
I have a script that first creates a "duration" column & evaluates.
Next, i have the script find blanks and fill with previous non blank value (for deadbanding). it does this by generating a pop-up window for one to select which columns need this applied (granted, if i could just assume all of them need it, that *could* be one option of circumventing this issue)
However, the script doesn't "wait" for me to select which columns i want to fill down before moving to next lines.
How do i get around this??
Names Default to Here(1);
dt=Current Data Table();
column(dt, "Time")<<Data Type("Numeric", Informat("m/d/y h:m:s"), Format("h:m:s"));
dt1=Current Data Table();
dt1<<New Column("Duration", Units("seconds"), Formula(:Time-Col Minimum(:Time)));
Column("Duration")<<data type(Numeric)<< Modeling Type(Continuous)<< Format("fixed dec", 20, 0);
_dt = Current Data Table();
colnames = _dt << Get Column Names( String );
fillcolumns = Expr(
selectedcols = _lb << Get Selected;
nc = N Items( selectedcols );
nr = N Rows( _dt );
For( ii = 2, ii <= nr, ii++,
For( jj = 1, jj <= nc, jj++,
If( is missing(Column( _dt, selectedcols[jj] )[ii]),
Column( _dt, selectedcols[jj] )[ii] = Column( _dt, selectedcols[jj] )[ii - 1]
);
)
);
_nw << Close Window;
);
_nw = New Window( "Fill Down Blanks",
_tb = Text Box("This script will fill missing values in the columns you select, by using the value in the last previous not empty row for that column"),
_hb = H List Box(
_pb = Panel Box( "Select Columns", _lb = List Box( colnames, width( 300 ) ) ),
_bb = Button Box( "Go", fillcolumns )
)
);
Names Default To Here(1);
dt3=Current Data Table();
dt3<<Select where(((:x==0) | (Is Missing(:x))));
dt3<<delete rows;
dt4=Current Data Table();
dt4<<New Column("a", formula(4));
Column(dt4, "a")<<data type(Numeric)<<Modeling Type(Ordinal);