Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
The lenght of a text field contains 12 characters, however, there are data with less than 12 characters (all of them). What I need is to complete each register of the text field with 0 (ceros) till complete 12 characters in total. I appreciate your help.
You can solve the subsequent zeros with adjustments to the previous suggested approach.
LOAD
Value,
right('000000000000' & Value, 12) as Preceding,
left(Value & '000000000000', 12) as Subsequent
inline [
Value
7525963
25
112233445566778899];
Please observe that if your Value consists of more than 12 characters it will be cropped by this approach.
Thank you,
No problem. I appreciate you help.
The issue is that there are some registers, one with 7 characters, another one wiht 2 characters, and so on.
I have to complete with 0 to the right to each of them until complete 12 characters,
For example, if one register is: "7525963" is has to be "752596300000"
If the other one is: "25" it has to be "25000000000000"
🙂
You can solve the subsequent zeros with adjustments to the previous suggested approach.
LOAD
Value,
right('000000000000' & Value, 12) as Preceding,
left(Value & '000000000000', 12) as Subsequent
inline [
Value
7525963
25
112233445566778899];
Please observe that if your Value consists of more than 12 characters it will be cropped by this approach.
Excelent, Well done !!! Vegar, I appreciate !.
In your first solution, one could also be use:
Left([Field_Name] & '000000000000', 12) as NewField
However, your second alternative is complete and better, also.
Many thanks,
JorgeH