Leading zeros in csv exports removed
I have several scheduled reports where the leading zeros in certain fields are removed. The field itself is formatted as text, and it shows up properly in the cards, however once it is emailed in a .csv file those zeros are gone. Is there a way, maybe even in the ETL or the card, that I can prevent this from happening?
Best Answer
-
If you open up the file in a text editor such as notepad are the leading zeros missing? I know Excel will often remove leading zeros if you just try and view it in there.
**Check out my Domo Tips & Tricks Videos
**Make sure to any users posts that helped you.
**Please mark as accepted the ones who solved your issue.1
Answers
-
If you open up the file in a text editor such as notepad are the leading zeros missing? I know Excel will often remove leading zeros if you just try and view it in there.
**Check out my Domo Tips & Tricks Videos
**Make sure to any users posts that helped you.
**Please mark as accepted the ones who solved your issue.1 -
They are in Notepad - but is there a way to prevent the extra step of having to go from Notepad to Excel?
0 -
Domo will frequently take it's "best guess" on the data type as you import it. unless you're importing it with Workbench I don't believe you can explicitly set the data type.
what you can do in MySQL or Magic 2.0 is use an LPAD() function to Left Pad the data.
Jae Wilson
Check out my 🎥 Domo Training YouTube Channel 👨💻
**Say "Thanks" by clicking the ❤️ in the post that helped you.
**Please mark the post that solves your problem by clicking on "Accept as Solution"2 -
Thanks @jaeW_at_Onyx, my issues are more related to the exporting of the card to csv. I still tried the LPAD() function in Magic 2.0 but ended up with the same results - no leading zeros. I appreciate the help anyways, I still learned a new function that I'm sure will help in other areas.
0 -
put a space in front of the lpad or a '.'
Jae Wilson
Check out my 🎥 Domo Training YouTube Channel 👨💻
**Say "Thanks" by clicking the ❤️ in the post that helped you.
**Please mark the post that solves your problem by clicking on "Accept as Solution"0 -
Where should it go exactly?
Example string: 100.804.6015.3601, LE.BA.CC.LC
Some LE's are 054, 056 etc. While some LC's are 0001, or 0039.
Attached screenshot is how I'm splitting them using LPAD(), previously I was just using the "Split Columns".
Unfortunately the preview showed a row that didn't have the data to split, but when it does it will show the proper split strings, and the format is text all the way through the card. And like @MarkSnodgrass mentioned, opening the .csv file in Notepad shows the leading zeros. They just go away when the .csv is opened in Excel.
0 -
When entering 0046 directly into Excel, for example, in order to not have Excel change it 46, you have to preface it with an apostrophe. You could try adding an apostrophe in your formula tile, but I am concerned how that will render on any cards you have built. If you don't care about the cards and just worry about the CSV file, I would add a CONCAT function to go with your LPAD function to add the leading apostrophe. It would look like this, for example:
CONCAT(''',LPAD('LE',3,'LE')
**Check out my Domo Tips & Tricks Videos
**Make sure to any users posts that helped you.
**Please mark as accepted the ones who solved your issue.0 -
I like the thought - however it's giving me an error. I'm starting to think this conversation needs to be had oustide the Domo community because you were right the first time that it's doing the right thing and spitting out the leading zeros, Excel just doesn't like it. And of course my end users can't just use Domo, we have to use Excel for some facets of our work. I really appreciate the help from both of you!!
0
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.5K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 8 Federated
- 2.9K Transform
- 100 SQL DataFlows
- 616 Datasets
- 2.2K Magic ETL
- 3.8K Visualize
- 2.5K Charting
- 738 Beast Mode
- 56 App Studio
- 40 Variables
- 684 Automate
- 176 Apps
- 452 APIs & Domo Developer
- 46 Workflows
- 10 DomoAI
- 35 Predict
- 14 Jupyter Workspaces
- 21 R & Python Tiles
- 394 Distribute
- 113 Domo Everywhere
- 275 Scheduled Reports
- 6 Software Integrations
- 123 Manage
- 120 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 10 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 108 Community Announcements
- 4.8K Archive