Script to transpose data in an existing data tableHi,
I like to find a script to transpose data. And this data should be inserted at the last row of an existing file. Following how I transpose the data:
Data Table( "pisnapshot Abfrage AL2" ) << Transpose(
columns( :value ),
Transpose selected rows only( 1 ),
Output Table( "AL2 Snapshot Transpose" )
);
Data Table( "pisnapshot Abfrage AL2" )
With that JMP copies the data every time a new Data Table. How is it possible to copy it into an existing File (File is open)?
I got the idea to select the transposed row ("AL2 Snapshot Transpose") and to copy it into my target file. But I was not able to find a command to copy the Row Values.
Re: Script to transpose data in an existing data tableyours is a better solution if you have the ":Tag" column for the matching of column namesRe: Script to transpose data in an existing data tableThank you for the fast response.
Meanwhile I tried something different. Therefore I used the function “concentrate”:
//transponse table
Data Table( "pisnapshot Abfrage AL2" ) << Transpose(
columns( :value ),
Transpose selected rows only( 1 ),
Label( :tag ),
Output Table( "AL2 Snapshot Transpose" ));
//add Table "AL2 Snapshot Transpose" to exsiting table "AL2 Snapshot"
Data Table( "AL2 Snapshot" ) << Concatenate(Data Table( "AL2 Snapshot Transpose" ),Append to first table);
//close table with “no save”
Close(Data Table( "AL2 Snapshot Transpose" ), No Save);
And it works perfectly. But I will try your solution .
Re: Script to transpose data in an existing data tableI think the script below is a simplier solution to what you stated you want
Names Default To Here( 1 );
dt = Current Data Table();
// Get the selected rows
selRows = dt << get selected rows;
If( N Rows( selRows ) > 0,
// Add the row to place the data into
dt << Add Rows( 1 );
// Go from column to column and move the selected data to the new row
For( i = 1, i <= N Cols( dt ), i++,
Column( dt, i )[N Rows( dt )] = Column( dt, N Col( dt ) )[selRows[i]]
);
// Delete the last column
dt << delete columns( Column( dt, N Cols( dt ) ) );
);