Anuviel Posted June 19, 2009 Posted June 19, 2009 I have a simple file with about 10 fields. The data contained needs to be exported into a .txt file. The issue I am having is that upon export the data has quotes like this: "manufacturer","masrp","keywords", is there a way to get rid of those so that it would look like: manufacturer masrp keywords I can achieve the latter by exporting as .tab however then the end user needs to manually rename the file to .txt (that is the extension that the export file has to have) which is what I am trying to avoid. Any pointers are welcome. Thanks.,
comment Posted June 19, 2009 Posted June 19, 2009 Can't you script the export, including the filename?
Anuviel Posted June 19, 2009 Author Posted June 19, 2009 Awesome, works without any problems. Thanks a lot Btw - can field names be exported as well?
comment Posted June 20, 2009 Posted June 20, 2009 Not directly. The merge format includes field names, but the data is comma-separated. The way to do this is by exporting as XML and using a custom stylesheet - see: http://fmforums.com/forum/showtopic.php?tid/183442/ for something very similar.
Anuviel Posted June 23, 2009 Author Posted June 23, 2009 Ok, implemented everything and all works as intended. I have however run into a small issue. The export with the style sheet works as it needs to however I do have a description field in my table. When users enter the the text description they use enter if the description is long... What would I need to add to the style sheet in order to filter out enter from all fields during the export? Example: If no enter is used when inputting data the export comes out in one line as needed. IE. This is a test export. Nicely done. If they use enter when inputting data the export comes out like this: IE. This is a test export. Nicely done Basically I do not know what to add to the style sheet in order to filter carriage returns out The style sheet I am using is this, from the link provided by Comment, I believe it was posted by Fenton: <?xml version='1.0' encoding='utf-8'?> exclude-result-prefixes="fmp" version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> seller-id gtin isbn mfg-name mfg-part-number asin seller-sku title description main-image additional-images weight features listing-price msrp keywords product-set-id store-code category-id
comment Posted June 23, 2009 Posted June 23, 2009 (edited) You can use functions in your stylesheet to process the data. To "substitute" carriage returns with spaces, use the translate function, e.g. You'd probably want to "trim" the result by using the normalize-space function so: NOTE: Replace [color:red]CR and [color:red]space with the corresponding character codes, or the actual characters. Edited June 23, 2009 by Guest
Anuviel Posted June 24, 2009 Author Posted June 24, 2009 Thank you kindly., It works without an issue now.
Anuviel Posted June 26, 2009 Author Posted June 26, 2009 (edited) Yep, I hit an issue again. The file itself is working ok and all looks in order. However when I upload the exported file to the server, I get an error. It is basically telling me that the file failed due to the number of columns not being correct. They require the file for the upload to be UTF-8, tab delimited. Is there a difference between xsl and tab delimited exports? When I export via xsl I get the error as described above. If I export via tab delimited file and manually type in the column headers I do not get the error. I hard coded column names in xsl, I separated the columns via actual tab, I also tried between columns and it still gave me the same error. Any suggestions as to what might be wrong? I can post exported files so they can be compared if needed. Thanks. Edited June 26, 2009 by Guest Forgot to enclose the tab char in code.
Recommended Posts
This topic is 5628 days old. Please don't post here. Open a new topic instead.
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