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-34972%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ER%C3%A9p%C3%A9ter%20une%20s%C3%A9quence%20dans%20une%20colonne%20-JSL%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-34972%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EJe%20regardais%20dans%20le%20guide%20de%20script%2C%20et%20il%20parle%20de%20Sequence(%20from%2C%20to%2C%20stepsize%2C%20repeat%20)%3B%20avec%20de%2C%20%C3%A0%2C%20pas%20%C3%A0%20pas%20et%20r%C3%A9p%C3%A9tition.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EEt%20si%20je%20veux%203%20valeurs%2C%20disons%201%2C%2050000%2C%20100000%20r%C3%A9p%C3%A9t%C3%A9es%20jusqu'%C3%A0%20la%20fin%20du%20tableau%20dans%20une%20colonne%26nbsp%3B%3F%20(Il%20s'agit%20essentiellement%20de%20mettre%20en%20%C3%A9vidence%20les%203%20valeurs%20dans%20une%20colonne%20et%20de%20cliquer%20avec%20le%20bouton%20droit%20de%20la%20souris%20et%20de%20dire%20remplir%20jusqu'%C3%A0%20la%20fin%20du%20tableau)%3C%2FP%3E%3CP%3EDois-je%20ex%C3%A9cuter%20une%20boucle%20for%2C%20ou%20existe-t-il%20un%20script%20d'une%20ligne%20disponible%20dans%20JSL%26nbsp%3B%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMerci%20beaucoup%20pour%20vos%20suggestions.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-189699%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%20%3A%20R%C3%A9p%C3%A9ter%20une%20s%C3%A9quence%20dans%20une%20colonne%20-JSL%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-189699%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3ESalut%20Mark%2C%3C%2FP%3E%3CP%3Ec'%C3%A9tait%20nouveau%20pour%20moi%20-%20merci.%20Pourriez-vous%20s'il%20vous%20pla%C3%AEt%20m'aider%20%C3%A0%20cr%C3%A9er%20un%20script%3F%20Nous%20importons%20r%C3%A9guli%C3%A8rement%20des%20donn%C3%A9es%20et%20devons%20toujours%20ajouter%20des%20colonnes%20avec%20par%20exemple%2010%20r%C3%A9p%C3%A9titions%20pour%20chaque%20valeur%20(de%201%20%C3%A0%2016).%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-35014%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%20%3A%20R%C3%A9p%C3%A9ter%20une%20s%C3%A9quence%20dans%20une%20colonne%20-JSL%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-35014%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EVoici%20un%20code%20pour%20jouer%20avec%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3Elst%20%3D%20%7B1%2C50000%2C100000%7D%3B%0AnRepeats%20%3D%2010%3B%0Avalues%20%3D%20Repeat(lst%2CnRepeats)%3B%20%2F%2F%20this%20will%20be%20a%20list%20of%2030%20values%0Avalues%5B1%3A%3ANRows(dt)%3B%0AColumn(dt%2C%22Test%22)%20%26lt%3B%26lt%3B%20Set%20Values(values)%3B%0A%2F%2F%20if%20the%20table%20only%20had%2025%20rows%20I%20could%20use%20values%5B1%3A%3A25%5D%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-34977%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%20%3A%20R%C3%A9p%C3%A9ter%20une%20s%C3%A9quence%20dans%20une%20colonne%20-JSL%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-34977%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3ENotez%20que%20lorsque%20vous%20s%C3%A9lectionnez%3CSTRONG%3E%20Cols%3C%2FSTRONG%3E%20%26gt%3B%3CSTRONG%3E%20Nouvelle%20colonne%3C%2FSTRONG%3E%20%2C%20il%20existe%20une%20option%20en%20bas%20de%20la%20bo%C3%AEte%20de%20dialogue%20pour%20initialiser%20la%20nouvelle%20colonne%20de%20plusieurs%20mani%C3%A8res%2C%20y%20compris%20une%20s%C3%A9quence.%20Si%20vous%20avez%20cr%C3%A9%C3%A9%20la%20nouvelle%20colonne%20en%20double-cliquant%20%C3%A0%20droite%20de%20la%20derni%C3%A8re%20colonne%2C%20s%C3%A9lectionnez%20la%20nouvelle%20colonne%20vide%20et%20s%C3%A9lectionnez%3CSTRONG%3E%20Cols%3C%2FSTRONG%3E%20%26gt%3B%3CSTRONG%3E%20Informations%20sur%20la%20colonne%3C%2FSTRONG%3E%20pour%20voir%20la%20m%C3%AAme%20fonctionnalit%C3%A9.%3C%2FP%3E%0A%3CP%3ENotez%20que%20cette%20fonctionnalit%C3%A9%20dispara%C3%AEt%20d%C3%A8s%20que%20vous%20entrez%20des%20valeurs%20dans%20la%20colonne%20d'une%20autre%20mani%C3%A8re.%3C%2FP%3E%0A%3CP%3EAucune%20formule%20ou%20script%20n%C3%A9cessaire%20pour%20un%20cas%20simple%20comme%20celui-ci.%20D%C3%A9j%C3%A0%20pr%C3%A9vu%2C%3C%2FP%3E%3C%2FLINGO-BODY%3E
Choose Language Hide Translation Bar
vishwasanj
Level V

Repeat a sequence in a column -JSL

I was looking into the scripting guide, and it talks about Sequence( from, to, stepsize, repeat ); with from, to , stepsize and repeat.

 

What if I want 3 values say, 1, 50000, 100000 repeated till the end of table in a column? (This is basically highlighting the 3 values in a column and right click and say fill to the end of the table)

Do i have to run a for loop, or is there like a one line script available in JSL? 

 

Thank you so much for your suggestions. 

1 ACCEPTED SOLUTION

Accepted Solutions
David_Burnham
Super User (Alumni)

Re: Repeat a sequence in a column -JSL

Here is some code to play with

lst = {1,50000,100000};
nRepeats = 10;
values = Repeat(lst,nRepeats); // this will be a list of 30 values
values[1::NRows(dt);
Column(dt,"Test") << Set Values(values);
// if the table only had 25 rows I could use values[1::25]
-Dave

View solution in original post

3 REPLIES 3

Re: Repeat a sequence in a column -JSL

Notice that when you select Cols > New Column, there is an option near the bottom of the dialog to initialize the new column in several ways including a sequence. If you created the new column by double-clicking to the right of the last column, then select the new, empty column and select Cols > Column Info to see the same feature.

Note that this feature disappears as soon as you enter any values in the column another way.

No formula or script necessary for a simple case like this one. Already provdided for,

PS_Ato
Level III

Re: Repeat a sequence in a column -JSL

Hi Mark,

this was new for me - thank you. Could you please help me how to create a script? We import data regularily and always need to add columns with e.g. 10 repetitions each value (from 1 to 16).

David_Burnham
Super User (Alumni)

Re: Repeat a sequence in a column -JSL

Here is some code to play with

lst = {1,50000,100000};
nRepeats = 10;
values = Repeat(lst,nRepeats); // this will be a list of 30 values
values[1::NRows(dt);
Column(dt,"Test") << Set Values(values);
// if the table only had 25 rows I could use values[1::25]
-Dave

Recommended Articles