Book a Demo

Author Topic: Custom Query Fragments : which syntax for document scripts  (Read 4300 times)

Michel Gibelli

  • EA Novice
  • *
  • Posts: 14
  • Karma: +1/-0
    • View Profile
Custom Query Fragments : which syntax for document scripts
« on: March 23, 2016, 01:36:15 am »
Hi!

I am trying to use the new document script feature for reporting described here
http://www.sparxsystems.com/enterprise_architect_user_guide/12.1/report_generation/custom_query_fragments.html

I have got some results and some problems

The following example is running :
The call in the document option/custom query tab :
test(#OBJECTID#, #PACKAGEID#, #Package#, 2)
and the function in VBscript :
Public Function test(objectID, packageID, package, depth)
   Session.Output "test : " & objectID & " " & packageID & " " & package & " " & depth
   dim docGenerator as EA.DocumentGenerator
   set docGenerator = Repository.CreateDocumentGenerator()
   docGenerator.NewDocument("")
' Make a SQL Select based on objectID
' using http://community.sparxsystems.com/community-resources/522-94execute-a-sql-query-and-return-the-result-in-a-dictionary-of-rows
' Iterate over the result
' Call docGenerator.DocumentElement(...) for each result
   test = docGenerator.GetDocumentAsRTF()
End Function

But I cannot get the others values as stated in the help page (#Branch#, #UserName#, #Author#)

Also I cannot put more than one line in the call. For example, with :
dim i: i = 3
test(#OBJECTID#, #PACKAGEID#, #Package#, i)
I get a syntax error.

Do you have more informations on what is allowed in the custom query tab and which syntax should be used (Javascript, Jscript, VBscript) ?

Thank you

Michel