In case you missed the announcement: The Alteryx One Fall Release is here! Learn more about the new features and capabilities here
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

How to make a specified sequence of numbers repeat in a column of data?

LeiCheng
8 - Asteroid

The number of rows in my table varies every time as I don't know how many rows of my raw data. I want to define a new column with a specified sequence of numbers repeat in it. such as repeat 123 in the new column:

1

2

3

1

2

3

.

.

.

Can  I do this? Thanks.

4 REPLIES 4
Qiu
21 - Polaris
21 - Polaris

@LeiCheng 
If I understand your requirement correctly, we can use generate Row tools to do something like this.

0204-Leicheng.png

LeiCheng
8 - Asteroid

@Qiu   You are amazing, thank you!

Qiu
21 - Polaris
21 - Polaris

@LeiCheng 
Glad to be any help.

brackley2
5 - Atom

There is an underutilized  Mod function that can assist with this as well.  

 

Where you have sequential RecordID and you need Groups that repeat in sequence like this:

 

 

Record IDGroup
11
22
33
41
52
63

 

Drop this syntax in a formula tool:

 

Replace(
   ToString(

      IF [RecordID] <=3
      THEN [RecordID]
      ELSE Mod([RecordID], 3)

      endif

   ),

 '0','3')

 

The Mod function provides the remainder after dividing by a given number (in this case 3). Numbers that are divisible by 3 will return 0, so we need to wrap this in a replace function to replace the 0 with 3. 

 

You'll probably want to immediately follow this with a select tool to convert Group back to INT

Labels
Top Solution Authors