Focal Point
[CLOSED] What is the function to Left pad the zeros in transformations

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/5577058096

October 17, 2018, 09:47 AM
rboya
[CLOSED] What is the function to Left pad the zeros in transformations
Hi,

I want to left pad a string based on a string length. I want to use it in transformations. Can I do it?

For ex: 1234 (I need to pad to 12 chars)
Expected Output : 000000001234 (8 zeros need to be padded)

I tried LPAD, LEFTPAD nothing seems to work.

Could you please let me know how can we achieve this?

Thank you in advance.

This message has been edited. Last edited by: FP Mod Chuck,


WebFOCUS 8
Windows, All Outputs
October 17, 2018, 10:18 AM
FP Mod Chuck
Rboya

What output format are you using? If it is Excel I don't think they will display.


Thank you for using Focal Point!

Chuck Wolff - Focal Point Moderator
WebFOCUS 7x and 8x, Windows, Linux All output Formats
October 17, 2018, 10:20 AM
rboya
Thanks Chunk for your reply.

I am writing it to a flatfile.

How can we do it?


WebFOCUS 8
Windows, All Outputs
October 17, 2018, 10:27 AM
MartinY
This could be an option where I assume that your input is a text then stays as text
DEFINE FILE CAR
TEXT /A4  = '1234';
PAD  /I12 = EDIT(TEXT);
TPAD /A12 = EDIT(PAD);
END
TABLE FILE CAR
PRINT TPAD
BY COUNTRY
END



WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
October 17, 2018, 10:29 AM
rboya
Thanks for your reply.

I am new to DM.

Trying to use function in transformations and getting below error.

0 NUMBER OF RECORDS IN TABLE= 6 LINES= 6

0 ERROR AT OR NEAR LINE 49 IN PROCEDURE __WCFEX FOCEXEC *
(FOC263) EXTERNAL FUNCTION OR LOAD MODULE NOT FOUND: LPAD
(FOC009) INCOMPLETE REQUEST STATEMENT
BYPASSING TO END OF COMMAND


WebFOCUS 8
Windows, All Outputs
October 17, 2018, 10:36 AM
BabakNYC
  
DEFINE FILE CAR
SALES_A/A11=LPAD(EDIT(SALES),12,'0');
END
TABLE FILE CAR
PRINT SALES SALES_A
BY COUNTRY
BY CAR
END



WebFOCUS 8206, Unix, Windows