Welcome, Guest. Please login or register.
Did you miss your activation email?

Author Topic: List of all variables  (Read 3061 times)

Paul Traut

  • Jr. Member
  • **
  • Posts: 59
    • View Profile
List of all variables
« on: September 25, 2017, 02:48:14 pm »
Hi,

is there a possibility to get all report variables from a template?
And it would be best, if I could mark some variables as mandatory within the template, so that no report can be created as long this variables are not set.

Why do I need this?
My idea is to generate a dynamic GUI, which gives me fields for all variables within one template so that the user can type in the data. Therefor it would also be great when the variable would store a type information (QString, Int, Date,...)
Also I would like to check if this variable is mandatory for the report and only generate the report when all mandatory variables are set.

Hope you can understand what I mean  :)

Arin Alex

  • Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 1005
    • View Profile
Re: List of all variables
« Reply #1 on: September 26, 2017, 12:56:08 am »
Hi!
I have added ability to set data type and mandatory to the report's variables (develop branch at github).
Also i have extend IDataSourceManager interface.
From now you can get all information about the report's variables:
1. Variable names via report.datamanager.variableNames()   
2. Variable data type via report.datamanager.variableDataType(const QString& name)
(enum VariableDataType {Undefined, String, Bool, Int, Real, Date, Time, DateTime})
3. Variable mandatory via report.datamanager.variableIsMandatory(const QString& name)
4. via report.datamanager.variableIsSystem(const QString& name) you can check that the variable is system

Paul Traut

  • Jr. Member
  • **
  • Posts: 59
    • View Profile
Re: List of all variables
« Reply #2 on: September 29, 2017, 09:13:52 am »
Thanks :D