Topic: Show .ini values in report

Hello friends,


In MVD i write values to an .ini file, like the following example:


company.ini

[company]
Edit1=name
Edit2=address

I need to show this information (company info) on the report, is there any way i can do this?


Thanks in advance

Re: Show .ini values in report

.

Post's attachments

Attachment icon test.7z 3.21 kb, 43 downloads since 2019-07-30 

Re: Show .ini values in report

sibprogsistem wrote:

.

hello sibprogsistem, thank you so much for example! however my compononents are not on the form where i am executing the report, is there a solution to this?

Re: Show .ini values in report

Hi Kristof,
Not sure without seeing the actual project, but can you copy the company information that you need to show to calculated fields and then use the calculated fields in the report?
If not, I think you might have to use reportsql rather than report.
Derek.

Re: Show .ini values in report

var
ini:TIniFile;
procedure Form1_Button1_OnClick (Sender: TObject; var Cancel: boolean);
begin
  ini:=TIniFile.Create(ExtractFilePath (ParamStr (0))+'setReport.ini');
  Form1.frxReport.Variables.Clear;
  Form1.frxReport.Variables[' ' + 'Seller'] := Null;
  Form1.frxReport.Variables['edit11'] := ini.ReadString('company','edit1','');
  Form1.frxReport.Variables['edit22'] := ini.ReadString('company','edit2','');
end;
Post's attachments

Attachment icon test.7z 2.91 kb, 35 downloads since 2019-07-30 

Re: Show .ini values in report

derek wrote:

Hi Kristof,
Not sure without seeing the actual project, but can you copy the company information that you need to show to calculated fields and then use the calculated fields in the report?
If not, I think you might have to use reportsql rather than report.
Derek.

Hello Derek,

Thanks for your help! yes i was thinking to use calculated fields but i couldn't find out how to get the ini values into the calculated fields.

7 (edited by dbk 2019-07-30 19:21:20)

Re: Show .ini values in report

sibprogsistem wrote:
var
ini:TIniFile;
procedure Form1_Button1_OnClick (Sender: TObject; var Cancel: boolean);
begin
  ini:=TIniFile.Create(ExtractFilePath (ParamStr (0))+'setReport.ini');
  Form1.frxReport.Variables.Clear;
  Form1.frxReport.Variables[' ' + 'Seller'] := Null;
  Form1.frxReport.Variables['edit11'] := ini.ReadString('company','edit1','');
  Form1.frxReport.Variables['edit22'] := ini.ReadString('company','edit2','');
end;

Thank you sibprogsistem! This works! However i have two problems:

- in the report the values aren't text but are presented as numbers (also in your example)
- when i run the report for the first time i can see the variables under Seller and use them BUT when i open another report the variables aren't there to use anymore so i can't use them in my report that i am already building

8 (edited by sibprogsistem 2019-07-31 01:13:56)

Re: Show .ini values in report

http://myvisualdatabase.com/forum/misc.php?action=pun_attachment&item=5674&download=0



 

var
ini:TIniFile;
procedure Form1_Button1_OnClick (Sender: TObject; var Cancel: boolean);
var
a1,b1:integer ;
begin
  ini:=TIniFile.Create(ExtractFilePath (ParamStr (0))+'setReport.ini');
  Form1.frxReport.Variables.Clear;
  Form1.frxReport.Variables[' ' + 'Seller'] := Null;
  Form1.frxReport.Variables['edit11'] :=ini.ReadInteger('company','edit1',a1);
  Form1.frxReport.Variables['edit22'] :=ini.ReadInteger('company','edit2',b1);
end;
Post's attachments

Attachment icon Безымянный.png 16.09 kb, 13 downloads since 2019-07-31