Generating data as a fixed-length record
Is it possible to generate data as a fixed-length record?
I want to be able to export a list of Users and all of their information.
Each user would be on a separate line.
i.e.
Name (20 char)| DOB (10 char - dd/mm/yyyy)| Location (20 char) | Company (20 char)
Best Answer
-
Hi @Rory - this is definitely possible in Xano.
You're able to use filters like sprintf or Replace to perform variable text substitution. And then a filter like substr would let you extract the amount of characters you want per piece of data.
Answers
-
That's great, thanks Micheal.
Just to complicate things a little more, is there any way to export or import .txt files as well?
I will have to export my data as a text file to be imported by another system. -
Hmm not natively but tell me a little more about your use case. Maybe there's a solution we can point you to. The data you need to export as .txt is from your Xano database? And are importing to another system via an API call or exporting a file and manually importing?
-
I have to upload the text files to a government body and they only accept it in this format.
I've attached an example for reference.
With regards to importing, this is a common feature offered by competing platforms. It allows customers to transfer their existing data over to a new platform.
Importing would require the removal of the blank spaces used in the fixed-length records. -
Hi @Michael Udinski , were you able to think of a workaround for my issue?
I forgot to mention earlier that the typical user workflows will be as follows:
Exporting Data:
- User filters a list of their company's data based on start & end dates.
- User Exports the txt file with fixed length records.
- User can then manually upload the txt file to the government website. (NB:This could be done with an API call in the future.)Importing Data:
- User uploads the txt file to my app (WeWeb+Xano)
- The fields will be cleaned up, removing unnecessary blank spaces from the fixed length records.
- Data is then imported into Xano and includes User's details.I hope this isn't too big of an ask. Unfortunately, it's the core feature that I have to include in my app.
Without it, my customers won't be compliant and I won't be able to sell to them.Thanks
Categories
- All Categories
- 53 ? Announcements
- 47 ? Releases
- 37 ? Welcome
- 983 ? Help! I'm a Noob
- 125 ? No-Code Front-Ends
- 633 ? Working with APIs
- 439 ? Transforming data
- 126 ? Connect Xano to ...
- 50 ?? Find an Expert
- 348 ❓Other questions
- 35 ? Security
- 22 ✂️ Snippets
- 19 ? Showcase
- 7 ?️ Xano Chatter
- 62 ? Video Tutorials
- 171 ? Request a feature
- 229 ? Report a Bug
- 19 ? Templates & Extensions
- 7 ? Feedback