Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: OpenIT Solutions on August 04, 2020, 12:48:56 am

Title: Pass a value to the DocumentGenerator class
Post by: OpenIT Solutions on August 04, 2020, 12:48:56 am
Hi,

I have this use case which i'd like some help with. We have a RTF report fragment with custom SQL. I'd like to prompt the user for a value, then pass the result to the ReportGenerator class and have it use the value in the where clause of the SQL fragment. Is this possible? Any way to pass a user entered value into the ReporGenerator. I can set Project Constants via the ReportGenerator - but there is no macro to query these in an SQL fragment (that i can see).

Any suggestions ?

Regards,

Jon.
Title: Re: Pass a value to the DocumentGenerator class
Post by: Uffe on August 04, 2020, 05:02:39 pm
Hi Jon,


AFAIK, and I do K quite a lot in this area, there is no way to pass stuff from the DocumentGenerator class into a template in the way you describe. The API is what it is, and the templates don't take parameters.

You can pull the project constants out of the database, but it's a little tricky.
Project constants are stored in t_rtf, which is one of those messy hacks that the EA schema is so fond of. It has two columns, Type and Template, and project constants are stored in a row where Type='ProjectOpts' and Template='name1=value1;name2=value2;...;'.

Extracting the specific constant you're after should be doable with a bit of SQL-fu.

So you can't prompt for a value and then pass it to the template through the API, but you can prompt for a value, store it in t_rtf, and then pull it from there into your SQL fragment.

HTH,


/Uffe