- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
How to automatically detect Index column by format?
Hi All,
I am creating an app using JMP Application Builder where a user opens a datafile into JMP and can perform some analyses. The program requires some kind of an index column (either date/time or a simple row index will suffice). Often, the type of data loaded into this application will have a date/time index, but this is not always the case and sometimes the first column is actual data (continuous, numeric, often decimal values).
I am looking for a way to automatically detect if the first column of a data table in JMP has date/time format (date/time index) or is a column of [1, 2, ..., N Cols] values (row index). If both of these checks for an index column are negative (meaning the first column is actual data values), then I can just insert a column with Row() formula to handle the index requirement.
Is it possible to use << Get Format and then use that result to investigate what I described? I have been unable to successfully do so, but I may not be looking in the right place. If I could get the output of << Get Format as a string, I could do some rudimentary search to see if it contains some mix of YYYY, M, or D, etc.
It is entirely possible to ask the user to simply add an index column before continuing to use the program, and for now that is what I am doing, but ideally the program would be able to automatically handle this.
Thanks for any advice,
Estelle
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to automatically detect Index column by format?
The Get Format() message returns an expression that can be used to format another column. If you want the format as a string you can get the first argument of that expression using the Arg() function.
New Table( "My Table",
Add Rows( 0 ),
New Column( "Column 1",
Numeric,
"Continuous",
Format( "mmddyyyy", 12 ),
Input Format( "mmddyyyy" ),
Set Selected
)
);
foo = :column 1 << get format;
//foo == Format( "mmddyyyy", 12 )
fmt = Arg( foo, 1 );
Show( fmt );
// fmt = "mmddyyyy";
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to automatically detect Index column by format?
The Get Format() message returns an expression that can be used to format another column. If you want the format as a string you can get the first argument of that expression using the Arg() function.
New Table( "My Table",
Add Rows( 0 ),
New Column( "Column 1",
Numeric,
"Continuous",
Format( "mmddyyyy", 12 ),
Input Format( "mmddyyyy" ),
Set Selected
)
);
foo = :column 1 << get format;
//foo == Format( "mmddyyyy", 12 )
fmt = Arg( foo, 1 );
Show( fmt );
// fmt = "mmddyyyy";
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to automatically detect Index column by format?
Ah, great! Thank you, Jeff, this is the step I was missing.