Subscribe Bookmark RSS Feed

Repeat a sequence in a column -JSL

vishwasanj

Frequent Contributor

Joined:

Dec 27, 2016

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

Joined:

Jul 13, 2011

Solution

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
2 REPLIES
markbailey

Staff

Joined:

Jun 23, 2011

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,

Learn it once, use it forever!
David_Burnham

Super User

Joined:

Jul 13, 2011

Solution

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