Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Create my own custom ID field

Shounak
6 - 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.

4 REPLIES 4
BenMoss
ACE Emeritus
ACE Emeritus

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

Shounak
6 - 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.

BenMoss
ACE Emeritus
ACE Emeritus

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

Shounak
6 - 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