How do i divide the entire table by , in one column?
As shown in the below picture, I'd like to divede the entire bable by , in on column!
So i maked the script, but not working the concatenate code.
Also, if the , is so many, this script is so inefficient.
How can i change the code more efficient? (using the for or while?)

dt = current data table();
newdt = dt << Subset( Output Table Name( "Graph table" ), All Columns( 1 ), All Rows( 1 ) ) ;
newdt << Select Where( Contains ( :As is Config , ",")) ;
newdt2 = newdt << Subset( Output Table Name( "Subset1" ), All Columns( 1 ), Selected Rows( 1 ) ) ;
newdt << new column("new As is Config", Formula(Left( :As is Config, Contains( :As is Config, "," ) - 1 )));
column(newdt, "new As is Config" ) << Eval Formula;
column(newdt, "new As is Config") << Delete Column Property( "Formula" );
column(newdt, "As is Config" ) << Formula(:new As is Config);
column(newdt, "As is Config" ) << Eval Formula;
column(newdt, "As is Config") << Delete Column Property( "Formula" );
newdt << Delete Columns( "new As is Config" );
newdt2 << new column("new As is Config", Formula(Substr(:As is Config, Contains( :As is Config, "," ) + 1, 100)));
column(newdt2, "new As is Config" ) << Eval Formula;
column(newdt2, "new As is Config") << Delete Column Property( "Formula" );
column(newdt2, "As is Config" ) << Formula(:new As is Config);
column(newdt2, "As is Config" ) << Eval Formula;
column(newdt2, "As is Config") << Delete Column Property( "Formula" );
newdt2 << Delete Columns( "new As is Config" );
newdt2 << Select Where( Contains ( :As is Config , ",")) ;
newdt3 = newdt2 << Subset( Output Table Name( "Subset2" ), All Columns( 1 ), Selected Rows( 1 ) ) ;
newdt2 << new column("new As is Config", Formula(Left( :As is Config, Contains( :As is Config, "," ) - 1 )));
column(newdt2, "new As is Config" ) << Eval Formula;
column(newdt2, "new As is Config") << Delete Column Property( "Formula" );
column(newdt2, "As is Config" ) << Formula(:new As is Config);
column(newdt2, "As is Config" ) << Eval Formula;
column(newdt2, "As is Config") << Delete Column Property( "Formula" );
newdt2 << Delete Columns( "new As is Config" );
newdt3 << new column("new As is Config", Formula(Substr(:As is Config, Contains( :As is Config, "," ) + 1, 100)));
column(newdt3, "new As is Config" ) << Eval Formula;
column(newdt3, "new As is Config") << Delete Column Property( "Formula" );
column(newdt3, "As is Config" ) << Formula(:new As is Config);
column(newdt3, "As is Config" ) << Eval Formula;
column(newdt3, "As is Config") << Delete Column Property( "Formula" );
newdt3 << Delete Columns( "new As is Config" );
newdt3 << Select Where( Contains ( :As is Config , ",")) ;
newdt4 = newdt3 << Subset( Output Table Name( "Subset3" ), All Columns( 1 ), Selected Rows( 1 ) ) ;
newdt3 << new column("new As is Config", Formula(Left( :As is Config, Contains( :As is Config, "," ) - 1 )));
column(newdt3, "new As is Config" ) << Eval Formula;
column(newdt3, "new As is Config") << Delete Column Property( "Formula" );
column(newdt3, "As is Config" ) << Formula(:new As is Config);
column(newdt3, "As is Config" ) << Eval Formula;
column(newdt3, "As is Config") << Delete Column Property( "Formula" );
newdt3 << Delete Columns( "new As is Config" );
both = newdt << concatenate( Graph table, Subset1, Subset2, "Append to first Table"); // this code is not working...My first comment, is to take a look at the
Text to Columns()
function, that would allow you to break out the C1, C2 etc values into their own columns. This might give you an advantage while you are working through your code.
Also look at the Word() function to help.
Finally, below is a change to your concatenation code which should work for you:
both = newdt << concatenate( Data Table("Graph table"),
Data Table("Subset1"),
Data Table("Subset2"),
Append to first Table(1));
Oh, Thanks
I remade the this code, but not working T.T
what is the problem?? in this script...
Names Default To Here( 1 );
dt = Current Data Table();
newdt = dt << Subset( Output Table Name( "Graph table" ), All Columns( 1 ), All Rows( 1 ) );
//Graph table
newdt << Select columns( :As is Config );
N = newdt << Subset( Output Table Name( "N" ), Selected Columns( 1 ), All Rows( 1 ) );
nColNow = N Items( n << get column names );
n << text to columns( delimiter( "," ), columns( :As is Config ) );
colAdded = N Items( n << get column names ) - nColNow;
For( i = 1, i <= colAdded, i++,
newdt[i] << Select Where( Contains( :As is Config, "," ) );
newdt[i + 1] = newdt << Subset( Output Table Name( "Subset" ), All Columns( 1 ), Selected Rows( 1 ) );
newdt[i] << New Column( "new As is Config",
Formula( Left( :As is Config, Contains( :As is Config, "," ) - 1 ) )
);
Column( newdt[i], "new As is Config" ) << Eval Formula; //Formula 특성 계싼!!
Column( newdt[i], "new As is Config" ) << Delete Column Property( "Formula" ); //formula 특성 지우기
Column( newdt[i], "As is Config" ) << Formula( :new As is Config );
Column( newdt[i], "As is Config" ) << Eval Formula; //Formula 특성 계싼!!
Column( newdt[i], "As is Config" ) << Delete Column Property( "Formula" ); //formula 특성 지우기
newdt[i] << Delete Columns( "new As is Config" ); // new As is Config 삭제!!
newdt[i + 1] << New Column( "new As is Config",
Formula( Substr( :As is Config, Contains( :As is Config, "," ) + 1, 100 ) )
);
Column( newdt[i + 1], "new As is Config" ) << Eval Formula; //Formula 특성 계싼!!
Column( newdt[i + 1], "new As is Config" ) << Delete Column Property( "Formula" ); //formula 특성 지우기
Column( newdt[i + 1], "As is Config" ) << Formula( :new As is Config );
Column( newdt[i + 1], "As is Config" ) << Eval Formula; //Formula 특성 계싼!!
Column( newdt[i + 1], "As is Config" ) << Delete Column Property( "Formula" ); //formula 특성 지우기
newdt[i + 1] << Delete Columns( "new As is Config" ); // new As is Config 삭제!!
newdt[i + 1] << Select Where( Contains( :As is Config, "," ) );
newdt[i + 2] = newdt[i + 1] << Subset(
Output Table Name( "Subset" ),
All Columns( 1 ),
Selected Rows( 1 )
);
);