Author Topic: Pass a value to the DocumentGenerator class  (Read 2968 times)

OpenIT Solutions

  • EA User
  • **
  • Posts: 555
  • Karma: +9/-1
    • View Profile
Pass a value to the DocumentGenerator class
« 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.

Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: Pass a value to the DocumentGenerator class
« Reply #1 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
« Last Edit: August 04, 2020, 05:18:11 pm by Uffe »
My theories are always correct, just apply them to the right reality.