community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
Upgrade Alteryx Designer in 10 Steps

Debating whether or not to upgrade to the latest version of Alteryx Designer?

LEARN MORE
SOLVED

Create my own custom ID field

Meteoroid

Dear All,

 

Im trying to make a new custom record field, so that it looks this A01, A02, A03 and so on. Currently the Record ID tool is only displaying without me being able to make any changes to it.

 

Any idea how?

 

Thank You.

Alteryx Certified Partner
Alteryx Certified Partner

Use the recordID to generate your numbers, then you can use a formula tool to add the letter prefix as you desired.

 

I suspect it's more complex than this mind.

 

Ben

Meteoroid

So lets say the output field is [Customer ID]

and [Customer ID_t] is a temporary field generated by the Record_ID tool.

All fields are set to vstring.

 

I tried this:

 

if [Customer ID_t]<="9" Then
PadLeft([Customer ID_t], 0, "C0")
else
PadLeft([Customer ID_t], 0, "c")
Endif

 

But the output is still 1,2,3,4 in the Customer ID field.

Alteryx Certified Partner
Alteryx Certified Partner

It appears your pad statement is incorrect.

The purpose of the PADLEFT function is too add the values in the 3rd part of the statement until the character length reaches that expressed by the 2nd part of the statement. 

 

You don't really need the if statement, it should be something like...


"C"+padleft([Customer ID_t],3,"0")

 

Make sure you convert the customer ID_t field to a string beforehand.

Alternatively if the padding needs to be more dynamic based on the number of ID's you can try the approach in the example attached.

This should also help you come to the solution.

Ben

Meteoroid

Thanks a lot, I realised that the if else statement was needless. Thanks.

Also that my padleft statement was wrong.

 

It works now.

 

Thank You :)

Labels