Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

Assign odd number as a record ID

yanatodorova26
7 - Meteor

Hi,

 

Is someone aware how can I assign a RecordID to be only odd numbers and vice versa - another recordID tool to assign only even numbers?

 

The idea would be to assign in a new column only odd or only even numbers as ID.

6 REPLIES 6
binuacs
21 - Polaris

@yanatodorova26 Once you apply the below filter tool you will get the odd and even number seperate 

binuacs_0-1684161542529.png

 

yanatodorova26
7 - Meteor

hi @binuacs , i want to add a new column that is having the idea of the RecordID, but instead of inserting consecutive numbers, to assign only odd values. i.e to have the ids 1,3,5,7, etc.

binuacs
21 - Polaris

@yanatodorova26 One way of doing this

binuacs_0-1684163108958.png

 

RobertOdera
13 - Pulsar

Hi, @yanatodorova26 

 

Kindly consider the below - I hope you find it helpful. Cheers!

RobertOdera_0-1684175649553.png

 

danilang
19 - Altair
19 - Altair

Hi @yanatodorova26 

 

A very simple way to do this is to add Record ID tool and then use a formula tool to modify the [RecordID] column.  [RecordID]*2-1 gives you odd numbers and [RecordID]*2 gives you the even ones

 

 

danilang_0-1684175968341.png

 

Dan

yanatodorova26
7 - Meteor

Hi All, thank you for the variety of possible solutions! They all are very helpful and interesting. I was able to solve it the following way:

 

1. Add a Record ID

2. Add a formula tool to modify the RecordID with the following expression: 2*[RecordID]+1 which will modify the ids to only odd ones.

yanatodorova26_0-1684222806876.png

 

Labels