cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Discussions

Solve problems, and share tips and tricks with other JMP users.
%3CLINGO-SUB%20id%3D%22lingo-sub-3165%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ENombre%20de%20lignes%20s%C3%A9lectionn%C3%A9es%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3165%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ELe%20volet%20inf%C3%A9rieur%20gauche%20d'un%20tableau%20de%20donn%C3%A9es%20JMP%20contient%20une%20liste%20contenant%20des%20informations%20sur%20les%20lignes%2C%20notamment%20le%20nombre%20de%20cellules%20actuellement%20s%C3%A9lectionn%C3%A9es.%3CBR%20%2F%3E%3CBR%20%2F%3E%20Existe-t-il%20une%20commande%20JSL%20permettant%20de%20r%C3%A9cup%C3%A9rer%20directement%20ces%20informations%26nbsp%3B%3F%20Je%20peux%20bien%20s%C3%BBr%20parcourir%20toutes%20les%20lignes%20et%20compter%20toutes%20les%20cellules%20s%C3%A9lectionn%C3%A9es.%20Cependant%2C%20il%20peut%20%C3%AAtre%20plus%20efficace%20de%20saisir%20un%20nombre%20que%20JMP%20semble%20d%C3%A9j%C3%A0%20avoir%20calcul%C3%A9%20automatiquement.%3CBR%20%2F%3E%3CBR%20%2F%3E%20Je%20demande%20parce%20que%20j'ex%C3%A9cute%20un%20script%20qui%20s%C3%A9lectionne%20conditionnellement%20diff%C3%A9rents%20ensembles%20de%20lignes%20dans%20une%20immense%20table%20et%20que%20je%20souhaite%20un%20moyen%20rapide%20de%20n%C3%A9gliger%20les%20ensembles%20avec%20trop%20peu%20de%20lignes.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3169%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%26nbsp%3B%3A%20Nombre%20de%20lignes%20s%C3%A9lectionn%C3%A9es%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3169%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EVers%20quoi%20pointe%20dtlist8%20%3FIl%20semble%20qu'il%20ne%20pointe%20pas%20vers%20une%20table.Le%20code%20suivant%20fonctionne%20%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3Edtlist8%20%3D%20open(%22%24sample_data%5CBig%20Class.jmp%22)%3B%0Aif(%20nrows(dtlist8%20%26lt%3B%26lt%3B%20get%20selected%20rows())%20%26gt%3B%200%2C%0A%20%20%20%20%20%20dtlist8%20%26lt%3B%26lt%3B%20delete%20rows%2C%0A)%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3168%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%26nbsp%3B%3A%20Nombre%20de%20lignes%20s%C3%A9lectionn%C3%A9es%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3168%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%26lt%3Bmeta%20http-equiv%3D%22Content-Type%22%20content%3D%22text%2Fhtml%3B%20charset%3DUTF-8%22%20%2F%26gt%3B%3CP%3Esalut%20PMroz%3C%2FP%3E%3CP%3EJ'essaie%20de%20s%C3%A9lectionner%20certaines%20lignes%20dans%20un%20tableau%20avec%20un%20crit%C3%A8re%2C%20puis%20de%20les%20supprimer%20si%20le%20nombre%20de%20lignes%20s%C3%A9lectionn%C3%A9es%20est%20sup%C3%A9rieur%20%C3%A0%200%20comme%20ci-dessous%2C%20mais%20j'ai%20l'erreur%20comme%20image%20ins%C3%A9r%C3%A9e.%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3Eif(%20(nrows(dtlist8%26lt%3B%26lt%3B%20obtenir%20les%20lignes%20s%C3%A9lectionn%C3%A9es()))%26gt%3B0%2C%3C%2FP%3E%3CP%3Edtlist8%20%26lt%3B%3CSUPPRIMER%20des%3D%22%22%20lignes%3D%22%22%3E%3C%2FSUPPRIMER%3E%3C%2FP%3E%3CP%3E)%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%2211365_pastedImage_0.png%22%20style%3D%22width%3A%20816px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%2211365_pastedImage_0.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%2211365_pastedImage_0.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F2969i66BCA72D64720175%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%2211365_pastedImage_0.png%22%20alt%3D%2211365_pastedImage_0.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3167%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%26nbsp%3B%3A%20Nombre%20de%20lignes%20s%C3%A9lectionn%C3%A9es%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3167%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3EMerci!%20Exactement%20ce%20que%20je%20cherchais.%20Simple%20et%20%C3%A9l%C3%A9gant.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3166%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%26nbsp%3B%3A%20Nombre%20de%20lignes%20s%C3%A9lectionn%C3%A9es%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3166%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3Enum_selected%20%3D%20nrows(dt%20%26lt%3B%26lt%3B%20get%20selected%20rows)%3B%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E
Choose Language Hide Translation Bar
ms
Super User (Alumni) ms
Super User (Alumni)

Number of selected rows

In the lower left pane of a JMP data table there is a list with row information, including the number of currently selected cells.

Is there a JSL command that can retrieve that information directly? I can of course loop through all rows and count all selected cells. However, it may be more efficient to grab a number that JMP already seem to have calculated automatically.

I am asking because I am running a script that conditionally selects different sets of rows in a huge table and want a fast way to neglect sets with too few rows.
1 ACCEPTED SOLUTION

Accepted Solutions
pmroz
Super User

Re: Number of selected rows

num_selected = nrows(dt << get selected rows);

View solution in original post

4 REPLIES 4
pmroz
Super User

Re: Number of selected rows

num_selected = nrows(dt << get selected rows);
ms
Super User (Alumni) ms
Super User (Alumni)

Re: Number of selected rows

Thanks! Just what I was looking for. Simple and elegant.
robust1972
Level IV

Re: Number of selected rows

hi, PMroz

I am trying to select certain rows in a table with a criteria and then delete them if the number of selected rows is greater than 0 as below but got the error as inserted pic.

if( (nrows(dtlist8<< get selected rows()))>0,

dtlist8 <<delete rows,

);

11365_pastedImage_0.png

pmroz
Super User

Re: Number of selected rows

What is dtlist8 pointing to?  It seems like it isn't pointing to a table.  The following code works:

 

 

dtlist8 = open("$sample_data\Big Class.jmp");
if( nrows(dtlist8 << get selected rows()) > 0,
      dtlist8 << delete rows,
);

 

Recommended Articles