Author Topic: Repository.Models.Refresh()  (Read 120 times)

BruceTOGAF2

  • EA User
  • **
  • Posts: 33
  • Karma: +0/-0
    • View Profile
Repository.Models.Refresh()
« on: January 12, 2018, 08:57:30 pm »
I have seen comments on this forum like "Repository.Models.Refresh() doesn't work".  In my experience it did work an other scripts but not in my current Jscript project.

My Jscript imports a word document into Sparx packages and Artifacts.  Each time I create a new package, I update the Package.TreePos with an incremental counter so that packages are sequenced correctly.  After the MS-Word document has been imported, I execute Repository.Models.Refresh(), but it is seemingly being ignored. Nothing changes.

If I close the Sparx project and re-open the project file, only then I can see the packages in the correct sequence as per Package.TreePos.

Why is Repository.Models.Refresh() failing?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 7816
  • Karma: +171/-21
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Repository.Models.Refresh()
« Reply #1 on: January 12, 2018, 09:28:03 pm »
Could it be that you have mixed up Repository.Models.Refresh() with Repository.RefreshModelView()

I think the latter is the one you need to reflect changes in the order of packages in the project browser.

Geert

BruceTOGAF2

  • EA User
  • **
  • Posts: 33
  • Karma: +0/-0
    • View Profile
Re: Repository.Models.Refresh()
« Reply #2 on: January 12, 2018, 09:37:39 pm »
Hi Geert,

I also tried Repository.RefreshModelView()

I got error "Argument not optional"

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 7816
  • Karma: +171/-21
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Repository.Models.Refresh()
« Reply #3 on: January 12, 2018, 10:55:42 pm »
you have to pass the package ID. Use "0" for whole model.

Geert

BruceTOGAF2

  • EA User
  • **
  • Posts: 33
  • Karma: +0/-0
    • View Profile
Re: Repository.Models.Refresh()
« Reply #4 on: January 12, 2018, 11:43:44 pm »
Thank you Geert.  I am very pleased with this development and with your help, so I will post the complete Jscript code in a new topic.

Import Word document into Sparx nested packages

Good idea?