Hi,
I am writing some code which imports data and I would like to do some data checking similar to MessyTables for python.
Data can be accidentally imported as character due to "NULL" or similar being present in the data. After removing the common instances of these I would like to check the data again to see if it is numeric.
The easiest way to do this is to use Try() and Matrix() after removing any "" around items in the list.
I could loop through the columnKeys and if the Num() conversion fails trigger a Throw(), this would be wasteful if the table is long and the column has many unique numbers.
The code below writes an error to the long, which is fine. However it also triggers a JMP Alert window once I incorporate it into my add-in but not if I run it directly.
Any suggestions of alternatives to check if a list is numeric or to suppress the JMP Alert dialog?
Thanks,
Stephen
dt = New Table( "Check Data",
Add Rows( 2 ),
New Column( "Column 1", Character, "Nominal", Set Values( {"+1%", "2", "-45"} ) )
);
a = Column(dt, "Column 1" ) << Get Values;
Try(
b = Matrix( Parse( Substitute( Char( a ), "\!"", "", " " ) ) );
Show( "Converted to Numeric." );
Show(b);
,
Show( "Not all Numeric..." );
Show(a);
);