Skip to main content
Solved

Format CSV into plain text with formatting in attachment - file "required"


fmesafe.podpora
Contributor
Forum|alt.badge.img+11

Hi, Is there a transformer within FME that could format CSV into plain text with formatting, see the attachment? The original file can also be in another format, for example excel. If someone can think of another writer that will facilitate the solution of the problem, it can be.

file original - source data

file required - required data

 Thank you

Best answer by fmesafe.podpora

Hi. I got the solution. If anyone in the future is dealing with the same problem, I am posting the solution below.

Thank you all for your support

View original
Did this help you find an answer to your question?

6 replies

jkr_wrk
Influencer
Forum|alt.badge.img+29
  • January 25, 2023

It looks like a pretty complicated format.

 

You have to determine what the column width is to prepent the data with enough spaces, but also have to account for the character-width of your value to determine if you should write data though other column space.

 

Or are the first 10 lines a header that is pretty much fixed?

 

Then you could use https://www.safe.com/transformers/string-padder/ to fix all the column widths and the https://www.safe.com/transformers/string-concatenator/ to glue all the data together.

 

 


fmesafe.podpora
Contributor
Forum|alt.badge.img+11
jkr_da wrote:

It looks like a pretty complicated format.

 

You have to determine what the column width is to prepent the data with enough spaces, but also have to account for the character-width of your value to determine if you should write data though other column space.

 

Or are the first 10 lines a header that is pretty much fixed?

 

Then you could use https://www.safe.com/transformers/string-padder/ to fix all the column widths and the https://www.safe.com/transformers/string-concatenator/ to glue all the data together.

 

 

Hi. Thanks for the reply. I took another look at the source file and couldn't find any logic for individual columns to count characters. I am also attaching the points for viewing. I have to meet with the person who supplied me with the original data and ask. I was looking at setting up the stringPadder transformer, do you think it can be formatted with this? I think the setting is insufficient. Thank you


ebygomm
Influencer
Forum|alt.badge.img+39
  • Influencer
  • January 26, 2023

You would need to know the widths of each column to pad them to the right length before writing out

image


fmesafe.podpora
Contributor
Forum|alt.badge.img+11
ebygomm wrote:

You would need to know the widths of each column to pad them to the right length before writing out

image

Hi Ebygomm. Thank you for the response, on Monday I will try to meet with the person who gives me the data and I will let you know according to which logic the output should be defined. This is a civil aviation system. Thank you very much


fmesafe.podpora
Contributor
Forum|alt.badge.img+11
ebygomm wrote:

You would need to know the widths of each column to pad them to the right length before writing out

image

Hi. I found more detailed information. I need to have the above values written in the txt file. The main criterion is this separator "|" and column width doesn't matter. It should look like the highlighted part in the attachment. Ideally without the header Name, Airspace etc. Please how do I modify it to the required data with the separator "|" and achieve writing to a txt file? Thanks a lot


fmesafe.podpora
Contributor
Forum|alt.badge.img+11
  • Author
  • Contributor
  • Best Answer
  • January 31, 2023

Hi. I got the solution. If anyone in the future is dealing with the same problem, I am posting the solution below.

Thank you all for your support


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings