Guilaine Pertel Posted April 19, 2021 Share Posted April 19, 2021 Hello, I would like to add zero before a field. For example , I have Customer number : 1234, and I would like all customer number in 10 digits with zero before. Link to comment Share on other sites More sharing options...
David Beagan Posted April 19, 2021 Share Posted April 19, 2021 If your field is a numeric data type then you can create a Compute with the L format: TABLE FILE ibisamp/ggsales PRINT SEQ_NO COMPUTE SEQ_NO_LZ/P10L = SEQ_NO; END Link to comment Share on other sites More sharing options...
Guilaine Pertel Posted April 19, 2021 Author Share Posted April 19, 2021 No, the field is a Alpha data. `TABLE FILE EMPLOYEE PRINT EMP_ID COMPUTE EMP_ID1/A15 = EMP_ID; WHERE RECORDLIMIT EQ 2 END Im waiting : EMP_ID EMP_ID1 071382660 000000071382660 112847612 000000112847612 ` Link to comment Share on other sites More sharing options...
David Beagan Posted April 19, 2021 Share Posted April 19, 2021 Perhaps there is something simpler, but this works: TABLE FILE ibisamp/employee PRINT EMP_ID COMPUTE EMP_A15/A15 = EMP_ID; COMPUTE EMP_RJ/A15 = RJUST(15, EMP_A15, 'A15'); COMPUTE EMP_RP/A15 = REPLACE(EMP_RJ, ' ', '0'); ON TABLE SET STYLEMODE FIXED WHERE RECORDLIMIT IS 2 END Link to comment Share on other sites More sharing options...
Michel Pageau Posted April 19, 2021 Share Posted April 19, 2021 Much simpler: TABLE FILE ibisamp/employee PRINT EMP_ID COMPUTE EMP_ID_LZ/P15L = EDIT(EMP_ID); NOPRINT COMPUTE EMP_ID1 /A15 = EDIT(EMP_ID_LZ); IF RECORDLIMIT IS 2 END Link to comment Share on other sites More sharing options...
Guilaine Pertel Posted April 19, 2021 Author Share Posted April 19, 2021 Thank you very much. Link to comment Share on other sites More sharing options...
David Beagan Posted April 19, 2021 Share Posted April 19, 2021 Very good, much simpler. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now