come selezionare le righe con un numero specifico immesso dall'utenteCiao a tutti,
Sto lavorando a un progetto che aiuta gli utenti a scegliere i moduli in base al loro input. Ad esempio, se l'utente immette 5, lo script fornisce all'utente 5 moduli che sono stati selezionati. Qualcuno potrebbe aiutarmi con la parte "seleziona"?
Re: come selezionare le righe con un numero specifico che l'utente ha inseritoGrazie mille per il vostro aiuto!
Re: come selezionare le righe con un numero specifico che l'utente ha inseritoSolo per divertimento, un metodo alternativo.
Names Default To Here( 1 );
dt = open("$sample_data/big class.jmp");
idx = Random Shuffle( dt << Get Rows Where( Column( "sex" )[]== "F" ) );
//get the matching rows but mix up the order;
show(idx); //for demonstration
//use only 5 of them
dtsub = << Subset( rows(idx[1::5]), Output Table( "Best Modules" ) );Re: come selezionare le righe con un numero specifico che l'utente ha inseritoQuesto dovrebbe funzionare
Names Default To Here( 1 );
dt << Select Where( Column( "Shippable to Reliability?" )[Row()] == 1 );
dtsub = dt << Subset( Selected Rows( 1 ), Output Table( "Best Modules" ) );
dtsub << New Column( "random", formula( Random Uniform() ) );
dtsub = dtsub << sort( by( :random ), order( ascending ), replace table( 1 ) );
dtsub << select where( Row() > 5 );
dtsub << delete rows;<BR />dtsub << delete columns("random");