Sparx Systems Forum

Discussion => Uml Process => Topic started by: Polymorph on September 09, 2016, 10:56:04 pm

Title: CSV export with notes
Post by: Polymorph 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.

(https://s21.postimg.org/9hnxnhoef/export_specificaion.png)

Many of my requirements have carriage returns in them.

(https://s14.postimg.org/d569fl71d/Requirement.png)

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

(https://s12.postimg.org/u5o54el4d/Export.png)

I get the feeling from looking through previous postings this is a known issue but I wasn't able to find the solution! :o
Title: Re: CSV export with notes
Post by: Geert Bellekens 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
Title: Re: CSV export with notes
Post by: Polymorph on September 09, 2016, 11:31:07 pm
Seriously?

That is rather disappointing - to put it mildly!
Title: Re: CSV export with notes
Post by: qwerty 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.
Title: Re: CSV export with notes
Post by: Glassboy 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++.
Title: Re: CSV export with notes
Post by: Sunshine 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.
Title: Re: CSV export with notes
Post by: Polymorph 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 >:(
Title: Re: CSV export with notes
Post by: qwerty 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.
Title: Re: CSV export with notes
Post by: Polymorph 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

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
Title: Re: CSV export with notes
Post by: Geert Bellekens 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
Title: Re: CSV export with notes
Post by: Polymorph on September 21, 2016, 12:54:14 am
You've got my vote