TextFileName
Hi,
My users can print, preview and export reports from my application. When
they choose to export a report (textfile,csv) the filename for the report is
assembled by the application. The filename is based on the reportname, the
user who's logged on and some timestamp. The directory is also defined by
the application and based on the home drive of the user.
Now I got the question if some week reports could be saved to a project dir
with a custom formatted filename.
My idea was that the end user could create a global function in RAP eg.
function GetTextFileName : string;
if he wants to override the default filename generation. The Delphi
application could call that RAP function to see what the name should be. If
there's no such function, the default application logic creates the
filename.
After reading the newsgroup I saw that a RAP function could not be called
from an Delphi application so the solution can't be used.
What other solution can you think of?
Using RB10.06 Ent / D7
Regards,
Jeroen R?ttink
My users can print, preview and export reports from my application. When
they choose to export a report (textfile,csv) the filename for the report is
assembled by the application. The filename is based on the reportname, the
user who's logged on and some timestamp. The directory is also defined by
the application and based on the home drive of the user.
Now I got the question if some week reports could be saved to a project dir
with a custom formatted filename.
My idea was that the end user could create a global function in RAP eg.
function GetTextFileName : string;
if he wants to override the default filename generation. The Delphi
application could call that RAP function to see what the name should be. If
there's no such function, the default application logic creates the
filename.
After reading the newsgroup I saw that a RAP function could not be called
from an Delphi application so the solution can't be used.
What other solution can you think of?
Using RB10.06 Ent / D7
Regards,
Jeroen R?ttink
This discussion has been closed.
Comments
Though it is not possible to call RAP functions from Delphi, it is possible
to access the declairations and code from Delphi using the TraCodeModule
class. You could perhaps declair a global constant containing the text
filename and then simply access that value.
var
lProgram: TraProgram;
lsSourceString: String;
begin
lProgram := TraCodeModule(ppReport1.CodeModule).GlobalConstProgram;
lsSourceString := lProgram.Source;
ShowMessage(lsSourceString);
end;
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
For those 'static' filenames I use parameters. They serve the same solution
in these cases.
It's more for cases where the filename is based on the moment the report is
executed. Eg. week reports with a possible filename of 'management
wk200710'.
Maybe an OnGetValue() for reports parameters?
Regards,
Jeroen.
Sorry, my idea was that your users define a global constant defining what
they would like the file to be named and you would search the RAP code for
that constant and if it exists, rename the file. Another option might be to
create an empty parameter that your users can assign from RAP and then you
can check that to see if the file should be renamed.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com