Author Topic: CSV export with notes  (Read 1518 times)

Polymorph

  • EA User
  • **
  • Posts: 120
  • Karma: +4/-0
    • View Profile
CSV export with notes
« on: September 09, 2016, 10:56:04 pm »
I wish to export requirements to Excel and have discovered the CSV export function. I have created a CSV Import/Export Specification and included the element name, type, GUID and notes fields.



Many of my requirements have carriage returns in them.



When these requirements are exported to the CSV file, EA seems to break up the requirement into two separate rows.



I get the feeling from looking through previous postings this is a known issue but I wasn't able to find the solution! :o

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 7740
  • Karma: +165/-21
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: CSV export with notes
« Reply #1 on: September 09, 2016, 11:26:35 pm »
I'm afraid the only solution is to write your own exporter; which isn't that hard luckily.

Geert

Polymorph

  • EA User
  • **
  • Posts: 120
  • Karma: +4/-0
    • View Profile
Re: CSV export with notes
« Reply #2 on: September 09, 2016, 11:31:07 pm »
Seriously?

That is rather disappointing - to put it mildly!

qwerty

  • EA Guru
  • *****
  • Posts: 8964
  • Karma: +136/-123
  • I'm no guru at all
    • View Profile
Re: CSV export with notes
« Reply #3 on: September 10, 2016, 12:09:06 am »
It might also be a fault in the importer. Nobody (Sparx, Mickeysoft, Apple, ...) cares about the RFC and implement their own flavor. See which separator and what quotation is used in the plain text file.

q.

Glassboy

  • EA User
  • **
  • Posts: 898
  • Karma: +52/-54
    • View Profile
Re: CSV export with notes
« Reply #4 on: September 12, 2016, 07:47:03 am »
Are you able to look at the resulting CSV file in a tool that will show you what is really there?  Like Notepad++.

Sunshine

  • EA User
  • **
  • Posts: 500
  • Karma: +33/-1
  • Amicorum omnia communia
    • View Profile
Re: CSV export with notes
« Reply #5 on: September 12, 2016, 09:56:38 am »
Not sure if it will address your problem but there is an Office MDG you could try the export facility to excel in that. You can down load a trial version to see if works for you.

Polymorph

  • EA User
  • **
  • Posts: 120
  • Karma: +4/-0
    • View Profile
Re: CSV export with notes
« Reply #6 on: September 13, 2016, 12:09:51 am »
Looking at the actual CSV file in Notpad++ as suggested reveals a possible answer!

Code: [Select]
PE-E5751-0342- Motor Demand Data: CRC Invalid;"The Motor shall reject CAN packets and the Motor Demand Data contained within the packet if the CRC within the packets does not match the CRC calculated from the packet contents.

Note: A CRC is included in each CAN packet to provide a means of checking if the packet has been corrupted. This CRC is in addition to the CRC provided by the CAN standard. All Motor Demand Data that is rejected is considered not to have been received. The rejection of the data can therefore lead to  Motor Demand Data Timeout conditions identified in other requirements.";Requirement;{1566C46D-A1D1-41dc-92AA-52B1F79B022D};CSVA9F9E3C9;

It seems that the CSV file that was exported might actually be right and Excel is ballsing it up >:(

qwerty

  • EA Guru
  • *****
  • Posts: 8964
  • Karma: +136/-123
  • I'm no guru at all
    • View Profile
Re: CSV export with notes
« Reply #7 on: September 13, 2016, 01:49:24 am »
Just what I said: nobody respects the RFC. You might need to alter newlines (in all its flavors) to a unique string and change that back once imported to Excel.

q.

Polymorph

  • EA User
  • **
  • Posts: 120
  • Karma: +4/-0
    • View Profile
Re: CSV export with notes
« Reply #8 on: September 20, 2016, 05:33:11 pm »
I wasn't feeling up to writing my own exporter as Geert suggested. Instead I wrote a small macro in Word to help get round the problem. It searches through the exported content and removes any extra carriage returns from the notes field. It's not well tested but if you want to use it go right ahead!

After adding the macro to a word document
  • Open CSV file in notepad/notepad ++
  • Copy/paste the CSV text into Word file containing macro
  • Run macro
  • Copy/paste modified CSV file into Excel
  • Use Text to columns function in Excel to convert the CSV text into separate columns

Code: [Select]
Sub eaExportFixer()
'
' eaExportFixer Macro
' This macro replaces paragraph markers within the notes field of exported enterprise archtect model elements to allow it to be exported to Excel
'
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "(CSV)([A-z0-9]{1,})(;^13)"
        .Replacement.Text = "\1\2;^l"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchAllWordForms = False
        .MatchSoundsLike = False
        .MatchWildcards = True
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    With Selection.Find
        .Text = "^13"
        .Replacement.Text = " "
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchAllWordForms = False
        .MatchSoundsLike = False
        .MatchWildcards = True
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
End Sub

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 7740
  • Karma: +165/-21
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: CSV export with notes
« Reply #9 on: September 20, 2016, 07:33:40 pm »
Cool workaround :D

I really should get the excel exporter thing going shouldn't I?
Maybe it's time for a new crowdfunding project...

Geert

Polymorph

  • EA User
  • **
  • Posts: 120
  • Karma: +4/-0
    • View Profile
Re: CSV export with notes
« Reply #10 on: September 21, 2016, 12:54:14 am »
You've got my vote