Author Topic: VBScript won't find Template anymore after packaged as MDG Technology  (Read 2529 times)

ndg2

  • EA Novice
  • *
  • Posts: 18
  • Karma: +0/-0
    • View Profile
Hello, an VBScript "UpperLowerReqs" invokes two Fragments "UpperLevelReqsFragment" and "LowerLevelReqsFragment". The VBScript itself gets invoked from within a "custom" section ("Custom Fragment Script") of another template. No problem so far as long as I work within my "Document Generation \ User Templates \ Mytemplates" folder within "Ressources". As soon as I package everything into an MDG Technology however, "UpperLowerReqs" won't be able to find  "UpperLevelReqsFragment" and "LowerLevelReqsFragment" anymore. Please note, those templates are there in the MDG XML! I made that sure. A workaround is to copy "UpperLevelReqsFragment" and "LowerLevelReqsFragment" into some other ressource folder of the model that imports the MDG. Suddnely the VBScript is able to find the templates again. Any ideas? Looks like some registration problem to me. I'm using EA 13.

Aaron B

  • EA Administrator
  • EA User
  • *****
  • Posts: 939
  • Karma: +17/-0
    • View Profile
This sounds like something that was fixed in EA 13. Can you confirm which specific build you are running? (See Help > About EA)

From the EA 13 release notes:
  MDG Technology Creation Wizard now preserves links between exported Scripts and Template Documents

When exporting the MDG technology with EA 13, the script GUID should be included as part of the export. When loading the MDG Technology, EA will use the supplied GUID (if available) to identify the script, so the template should now be able to reference it correctly.

If your technology was built with an older version, you may need to re-build it using EA 13 or higher.

ndg2

  • EA Novice
  • *
  • Posts: 18
  • Karma: +0/-0
    • View Profile
This sounds like something that was fixed in EA 13. Can you confirm which specific build you are running? (See Help > About EA)

From the EA 13 release notes:
  MDG Technology Creation Wizard now preserves links between exported Scripts and Template Documents

When exporting the MDG technology with EA 13, the script GUID should be included as part of the export. When loading the MDG Technology, EA will use the supplied GUID (if available) to identify the script, so the template should now be able to reference it correctly.

If your technology was built with an older version, you may need to re-build it using EA 13 or higher.
I'm running 13.0.1306. So this fix should have been incorporated already and I should not experience this problem?

Aaron B

  • EA Administrator
  • EA User
  • *****
  • Posts: 939
  • Karma: +17/-0
    • View Profile
Depends when your MDG Technology was built. As per the last line of my last post - "If your technology was built with an older version, you may need to re-build it using EA 13 or higher."

Using EA 13, build your MDG Technology file again. Hopefully this resolves the problem.

ndg2

  • EA Novice
  • *
  • Posts: 18
  • Karma: +0/-0
    • View Profile
Depends when your MDG Technology was built. As per the last line of my last post - "If your technology was built with an older version, you may need to re-build it using EA 13 or higher."

Using EA 13, build your MDG Technology file again. Hopefully this resolves the problem.
Well, I guess not. Because I built the MDG Tech with exactly the same version, I experienced the problem with (13.0.1306). Any further ideas?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 11111
  • Karma: +405/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
I think the workaround before the fix was to:

- generate the MDG technology containing the script
- import this MDG technology into your development model (your model now has two version of the script, one from the MDG and one from the model)
- open the template fragment properties and select the MDG script instead of the model script
- remove the MDG from your development model (your fragment should now no longer work in your development model as it is linked to a script that no longer exists)
- generate the MDG containing both the script as the template fragment
- Test your MDG in a new model

Geert

PS. I personally haven't tested whether or not this issue has been solved in v13 or later.

ndg2

  • EA Novice
  • *
  • Posts: 18
  • Karma: +0/-0
    • View Profile
Thank you Mr. Bellekens, I will try out this trick and report back!

ndg2

  • EA Novice
  • *
  • Posts: 18
  • Karma: +0/-0
    • View Profile
Hello,

I imported the MDG Tech into my development model. Now, as described below, I have two identical document generators in Ressources. However, I don't get what exactly is meant with the next step:

- open the template fragment properties and select the MDG script instead of the model script

Geert
Do you mean the properties of a particular selected and open template / fragment? I don't find a "path" field in the properties. How can I point to a different location? Or do you mean some property of the imported MDG Tech? I'm puzzled.

Nizam

  • Prolab Moderator
  • EA User
  • *
  • Posts: 314
  • Karma: +14/-2
  • Model Sharing - Simplified
    • View Profile
    • Professional Model Collaboration
It could be ambiguous at times.
Once you've imported the MDG, remove your local scripts so that you'll only have the MDG script to choose from.

If you repackage after doing this, the mapping will (should) work as Geert mentioned.

ndg2

  • EA Novice
  • *
  • Posts: 18
  • Karma: +0/-0
    • View Profile
It could be ambiguous at times.
Once you've imported the MDG, remove your local scripts so that you'll only have the MDG script to choose from.

If you repackage after doing this, the mapping will (should) work as Geert mentioned.
I actually tried that. Removed the local scripts, tried to recreate the MDG Technology. But the MDG "Wizard" couldn't find the scripts that were imported before! They aren't visible. So I cannot recreate the MDG Tech. Now I could copy the imported templates (into "user" ressources), but I guess I will run into the same problem as before.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 11111
  • Karma: +405/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: VBScript won't find Template anymore after packaged as MDG Technology
« Reply #10 on: July 04, 2018, 08:48:19 pm »
- import MDG
- export all scripts (backup)
- delete the model scripts
- link your template to the MDG script(s)
- re-import your model scripts
- regenerate MDG

Geert

ndg2

  • EA Novice
  • *
  • Posts: 18
  • Karma: +0/-0
    • View Profile
Re: VBScript won't find Template anymore after packaged as MDG Technology
« Reply #11 on: July 05, 2018, 11:51:18 pm »
I'm unable at the moment with step "link your template to the MDG script(s)". They won't be found.
That being said I think, I have to clarify again, that it's the VB script that's unable to find the templates,
not the other way around. The script(s) get always been found by the templates.

I wonder, whether the templates are found by some namespace / name combo or just by GUID?
In the former case, there should be a chance then just to "prefix" the template name with some
additional path / folder name to get them found? Didn't find anything like that in the MDG .xml
or .mts file, though.

On a related note: does anybody know in which SQL table scripts and templates are stored?
We were unable to find imported scripts. I know that there are stored locally when you
"import to user" a MDG Technology, but on a SQL server, they should be stored in some
database table, no?


Geert Bellekens

  • EA Guru
  • *****
  • Posts: 11111
  • Karma: +405/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: VBScript won't find Template anymore after packaged as MDG Technology
« Reply #12 on: July 06, 2018, 12:08:43 am »
Ah, I see.

template -> script -> template

Can you post the code that invokes the templates?

MDG stuff is not really stored in the database, but only kept in memory.

But if you import an MDG into a model the MDG file itself is stored in t_document.

AFAIK the process of loading an MDG is exactly the same regardless of its location (model, user profile, file location)

Geert


ndg2

  • EA Novice
  • *
  • Posts: 18
  • Karma: +0/-0
    • View Profile
Re: VBScript won't find Template anymore after packaged as MDG Technology
« Reply #13 on: July 11, 2018, 01:52:44 am »
Thanks regarding the script location.

The code for invocation of the template is

' actual RTF generation for one requirement and a given template
function documentReq(docGenerator, req, template)
    dim reqSuccess

   Session.Output "template name: """ & template & """"
   reqSuccess = docGenerator.DocumentElement(req.ElementID, 1, template)
    if reqSuccess then
        Session.Output "Requirement """ & req.Name & """ successfully evaluated"
    else
        ReportWarning "Error evaluating requirement """ & req.Name & """, (ID: " & req.ElementID & "): "  & docGenerator.GetLastError()
    end if
   
   documentReq = reqSuccess
end function

Of course "template" was initialised before correctly.