How to Write this Sub-Procedure

I do this procedure at the start of my report:

procedure ReportOnStartReport(Sender: TfrxComponent);
begin
if (Pos('/',<StartDate>) <> 0) then Set('StartDate', StrToDate(<StartDate>))
else Set('StartDate', StrToFloat(<StartDate>));

if (Pos('/',<?EndDate>) <> 0) then Set('?EndDate', StrToDate(<?EndDate>))
else Set('?EndDate', StrToFloat(<?EndDate>)); }
end;


How would I write a separate procedure to do this? I want to send in the variable (StartDate or EndDate) and have this procedure re-set the value. I am not sure how to write the code so that I can just run this:


procedure ReportOnStartReport(Sender: TfrxComponent);
begin
PrepareDate (<StartDate>);
PrepareDate (<EndDate>);
end;

procedure PrepareDate;
begin
//this is what I don???t know how to write
end;



Any help with writting sub-procedures would be helpful. Also, what I would love is to be able to put this sub-function in a shared .pas file.

Thank you!


Comments

  • gordkgordk St.Catherines On. Canada.
    edited 1:55PM
    any function can be added to a file see the developers manual.
    i am not sure which product(s) you work with as your post's show up in different forums.
    I am not sure of what you are trying to achieve as some of code appears to be internal report code
    and yet you are talking about passing in from delphi.

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.