How to Export with Leading Zeroes Into a CSV File

Problem

I want to Import Data from an external application, do some research and calculation on it and export it later for further processing. The output file is then uploaded to another application that requires leading zero(s) for integer. 

Goal

How to export INTEGER as STRING with leading zeros?

Learn

As an export into a CSV will result technically in a TXT file, we could create a separate column or sheet where the INTEGER value is converted into a STRING. This STRING needs to be formatted with leading zeros before export. E.g. if you have a kind of ID, which can have nine digits, than you need to add nine zeros before.

The second function will convert the INTEGER into a BIGDECIMAL and convert than into a STRING. This is to workaround DAP-21688. It adds the leading zeros and catch up the nine significant digits from the right side.

Solution Proposal 1

IF(LEN(T(#NeedLeadingZero))<9;RIGHT(("000000000"+T(#NeedLeadingZero));9);T(#NeedLeadingZero))

Solution Proposal 2

RIGHT(("000000000"+T(BIGDECIMAL(#NeedLeadingZero)));9)