How to add leading zeros in formula recipe while concatenating strings?

PANKAJ
PANKAJ Partner, L2 Admin, Dataiku DSS Core Designer, Dataiku DSS & SQL, Dataiku DSS ML Practitioner, Dataiku DSS Core Concepts, Registered Posts: 26 Partner

Suppose I'm concatenating two strings(or integers) or maybe a combination of them and placing the resultant value in a new column using a formula inside prepare recipe. (I'm using formula as concat(strval("col_1"),strval("col_2")) and placing the value in a new column "new_col".)

if col_1 & col_2 have values 00 & 0011 respectively it gives 000011.or

if col_1 & col_2 have values S & 0125 respectively it gives S0125.

To standardize the new column, I want 4 digit strings from col_1 & col_2 respectively by placing leading zeros in whichever column requires so that my resultant output will be 00000011 instead of 000011 and 000S0125 instead of S0125.

Any inputs on how can I put those leading zeros? Do I need any changes in that formula?

Answers

Setup Info
    Tags
      Help me…