How to name window to include unique values from column, separated by _I'm trying to rename a table so that it includes the unique names that appear in my column ("Product"). Sometimes I have one product, while other times I may have several products.
How would I script this? Below is what I have so far, which names the window with "-Data Table" and today's date.
dt1stacked << Set name( (ProductList, ",") || " -Data Table" || " " || Short Date( Today() ) );
Thanks!
Data TableScriptingRe: How to name window to include unique values from column, separated by _Here is a little function that will do what you asked for
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/big class.jmp" );
setName = Function( {dt, colName},
{defaultlocal},
Summarize( dt, byGroup = by( As Column( dt, colName ) ) );
theName = Column( dt, colName ) << get name;
For( i = 1, i <= N Items( byGroup ), i++,
theName = theName || "_" || byGroup[i]
);
Column( dt, colName ) << set name( theName );
);
setName( dt, "age" );Re: How to name window to include unique values from column, separated by _Assuming ProductList is from a summary or something. Try
dt1stacked << Set name( ConcatItems(ProductList, ",") || " -Data Table" || " " || Short Date( Today() ) );