Author Topic: Bellekens importer error 'Name cannot be blank'  (Read 2951 times)

Richard Freggi

  • EA User
  • **
  • Posts: 493
  • Karma: +18/-7
    • View Profile
Bellekens importer error 'Name cannot be blank'
« on: February 02, 2023, 08:10:09 pm »
I have been using Geert's importer for a couple of years, but since I updated to EA version 16.1 (or maybe since I got a Windows update?  Can't tell) I get the following error when I import attributes into classes:

Run-Time error '-2147221504 (80040000)'
Name cannot be blank

I have been trying different things but always get the same error, does anyone have any experience on how to solve?  Thanks!

ps Importer version 5.0
« Last Edit: February 02, 2023, 08:26:17 pm by Richard Freggi »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13404
  • Karma: +567/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Bellekens importer error 'Name cannot be blank'
« Reply #1 on: February 02, 2023, 09:19:35 pm »
Hi Richard,

Yeah, that's annoying. EA has made a breaking change to the api, and now doesn't allow to add attributes with an empty string as name anymore.
The fix is simple enough luckily. In the code, look for the line that does an Attributes.AddNew() and replace the empty string with something like "dummy"

I'll post an update with a link to the new version of the importer later...

Geert

Richard Freggi

  • EA User
  • **
  • Posts: 493
  • Karma: +18/-7
    • View Profile
Re: Bellekens importer error 'Name cannot be blank'
« Reply #2 on: February 02, 2023, 10:31:03 pm »
Thanks Geert I suspected it was some API change in EA!  But all my attributes have a name.

My Excel file looks like this:


Code: [Select]
Action CLASSTYPE CLASSGUID ownerField Pos Name Notes Alias Datatype
Update Class {EFED214F-70DD-47f1-90FC-C8DEC586DC4F} {EFED214F-70DD-47f1-90FC-C8DEC586DC4F} -1 CV_S_D01_PURCHASE_SERVICE_LINE_DETAILS Type: CALC.  .  CV_S_D01_PURCHASE_SERVICE_LINE_DETAILS CV_S_D01_PURCHASE_SERVICE_LINE_DETAILS
Create Attribute {EFED214F-70DD-47f1-90FC-C8DEC586DC4F} 0 0AF_COLOR___T Text column for attribute 0AF_COLOR Text column for attribute 0AF_COLOR NVARCHAR
Create Attribute {EFED214F-70DD-47f1-90FC-C8DEC586DC4F} 0 0AF_FCOCO___T Text column for attribute 0AF_FCOCO Text column for attribute 0AF_FCOCO NVARCHAR
Create Attribute {EFED214F-70DD-47f1-90FC-C8DEC586DC4F} 0 0AF_GENDER___T Text column for attribute 0AF_GENDER Text column for attribute 0AF_GENDER NVARCHAR

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13404
  • Karma: +567/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Bellekens importer error 'Name cannot be blank'
« Reply #3 on: February 02, 2023, 10:37:32 pm »
Thanks Geert I suspected it was some API change in EA!  But all my attributes have a name.

My Excel file looks like this:


Code: [Select]
Action CLASSTYPE CLASSGUID ownerField Pos Name Notes Alias Datatype
Update Class {EFED214F-70DD-47f1-90FC-C8DEC586DC4F} {EFED214F-70DD-47f1-90FC-C8DEC586DC4F} -1 CV_S_D01_PURCHASE_SERVICE_LINE_DETAILS Type: CALC.  .  CV_S_D01_PURCHASE_SERVICE_LINE_DETAILS CV_S_D01_PURCHASE_SERVICE_LINE_DETAILS
Create Attribute {EFED214F-70DD-47f1-90FC-C8DEC586DC4F} 0 0AF_COLOR___T Text column for attribute 0AF_COLOR Text column for attribute 0AF_COLOR NVARCHAR
Create Attribute {EFED214F-70DD-47f1-90FC-C8DEC586DC4F} 0 0AF_FCOCO___T Text column for attribute 0AF_FCOCO Text column for attribute 0AF_FCOCO NVARCHAR
Create Attribute {EFED214F-70DD-47f1-90FC-C8DEC586DC4F} 0 0AF_GENDER___T Text column for attribute 0AF_GENDER Text column for attribute 0AF_GENDER NVARCHAR
Yes, I know, but the version you are using creates an attribute without name first, and then fills in the name (and the other properties)
So the VBA code needs changing.

Geert

Richard Freggi

  • EA User
  • **
  • Posts: 493
  • Karma: +18/-7
    • View Profile
Re: Bellekens importer error 'Name cannot be blank'
« Reply #4 on: February 02, 2023, 10:47:26 pm »
Thanks Geert it works!

Anyone else, in VBA class module 'EAConnector' , ' Description: import the attribute based on the given properties into the parentPackage'  change

Code: [Select]
        If attr Is Nothing Then
            Set attr = owner.attributes.AddNew("", "")
            attr.update
        End If

into

Code: [Select]
        If attr Is Nothing Then
            Set attr = owner.attributes.AddNew("NULL", "NULL")
            attr.update
        End If

Thanks very much Geert!!!!

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13404
  • Karma: +567/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Bellekens importer error 'Name cannot be blank'
« Reply #5 on: February 02, 2023, 11:10:17 pm »
You only needed to change the first parameter (name), so 

Code: [Select]
Set attr = owner.attributes.AddNew("NULL", "")
Would be just fine.
The second parameter is the type parameter. If you didn't include that field in your excel, you would end up with type "NULL" in EA

Geert

Richard Freggi

  • EA User
  • **
  • Posts: 493
  • Karma: +18/-7
    • View Profile
Re: Bellekens importer error 'Name cannot be blank'
« Reply #6 on: February 03, 2023, 05:28:52 pm »
Thanks very much Geert - I can import objects and attributes but try as I might import of attribute length and precision fails (these properties remain blank in EA).  An ideas?
My Excel looks like this:

Code: [Select]
Action CLASSTYPE CLASSGUID ownerField Pos Name Stereotype Notes Alias Datatype multiplicity visibility length precision
Class {39C513D7-6EEE-4a36-B6C8-868C8446A47D} {39C513D7-6EEE-4a36-B6C8-868C8446A47D} -1 CV_MS4_P2_GLOBAL_EVENTS_DATA View Type: CALC.  .  GLOBAL EVENTS DATA GLOBAL EVENTS DATA
Attribute {39C513D7-6EEE-4a36-B6C8-868C8446A47D} 0 MAKT_MAKTG Material Description in Upper Case for Matchcodes Material Description in Upper Case for Matchcodes NVARCHAR 40
Attribute {39C513D7-6EEE-4a36-B6C8-868C8446A47D} 0 MARA_MATKL Material Group Material Group NVARCHAR 9
Attribute {39C513D7-6EEE-4a36-B6C8-868C8446A47D} 0 MARA_MSTAE Cross-Plant Material Status Cross-Plant Material Status NVARCHAR 2

ps Even if I remove the multiplicity, visibility and precision columns with no value, length will not import

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13404
  • Karma: +567/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Bellekens importer error 'Name cannot be blank'
« Reply #7 on: February 03, 2023, 06:04:04 pm »
are you sure it's not imported?
It might be that it's in the database, but EA refuses to show it.
IIRC EA will only show these field on database columns.

Geert

Richard Freggi

  • EA User
  • **
  • Posts: 493
  • Karma: +18/-7
    • View Profile
Re: Bellekens importer error 'Name cannot be blank'
« Reply #8 on: February 03, 2023, 10:14:13 pm »
Spot on Geert, I can see the length in t_attribute but it does not show in the Properties window of the attribute.  I would have never guessed.

I'll raise a bug with Sparx