In another thread, I mentioned that I often used to write code of the form:
FILL( '0', [PadSize] - LONG( TRIM( STR( [Number], [PadSize], 0)))) | TRIM( STR( [Number], [PadSize], 0));
This was useful when I occasionally wanted to risk writing a rule to define the value of a padded code alias or string attribute, based on a numeric attribute.
I thought I’d see if I could create a Blueprint to generate exactly that code, and here is the result:
pad-number-to-string.zip (1.3 KB)
Simply unzip the attachment and copy into a blueprints/rule/pad-number-to-string
folder on an Arc v5.0.0
sever to see it in action.
Input data:
Blueprint output:
['Employee Number (Padded)'] = S: FILL( '0', 6 - LONG( TRIM( STR( DB('}ElementAttributes_Employee', !Employee, 'Employee Number'), 6, 0)))) | TRIM( STR( DB('}ElementAttributes_Employee', !Employee, 'Employee Number'), 6, 0));
Result
And if we add the Employee Number (Padded)
string attribute to our Employee dimension and paste rule code the above:
Anyone else got any fun Blueprints ideas to share?