Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Autofill a string field

sarithaligonanu
6 - Meteoroid

Hi there,

 

I am fairly new to alteryx. I don't even know how to ask a question 😞 sorry!

 

Please see my input and the desired output below.

 

In the input there will be empty values for the ID field (string)?

I have to assign new IDs to these products in the format 'Product.xxx'. But the xxx' part has to increased by 1 each time.

 

Is there a way alteryx can auto-fill the ID field (string)?

 

Example input:

IDProduct 
Product.001Apple
Product.002Orange
Product.003Mango
 Kiwi
 Banana

 

Output I am after should look like this:

IDProduct 
Product.001Apple
Product.002Orange
Product.003Mango
Product.004Kiwi
Product.005Banana

 

Thanks heaps,

4 REPLIES 4
neilgallen
12 - Quasar

One way is to add a record ID using the recordID tool. Keep in mind that you'll want to use a string here, and specifiy how many digits you want to include (in your example, 3).

 

Then follow with a formula tool, modifying your existing ID column with the formula

 

"Product." + [RecordID]

 

and then you can drop the original recordID field with a select tool. This is a simple way to go about it.

sarithaligonanu
6 - Meteoroid

Thanks for the reply.

But I am not allowed to modify the existing ID column as we are using this as unique ID field and used in lots of other calculations and comparisons between weekly reports.

neilgallen
12 - Quasar

No problem, you could easily create a new field with the same formula, leaving the existing ID column alone. The logic remains.

sarithaligonanu
6 - Meteoroid

Thanks,

I sorted the ID field in descending order and then added a record id tool followed by a formula tool to enter the ID where ever the ID field is Null. It worked, thanks.

Labels
Top Solution Authors