How to test for a file existence
Can anybody help, I want to load images from files stored on network (paths
are stored in my database)
I can get it to work but if the file does not exist it falls over. Therefore
I want to test if the file exists before printing. The code below does not
compile in RAP.
If (FileExists(doc_image['URL_PATH'])) then
Image1.Picture.loadfromfile(doc_image['URL_PATH']);
Can anybody help me please.
Many thanks in advance
Mark
are stored in my database)
I can get it to work but if the file does not exist it falls over. Therefore
I want to test if the file exists before printing. The code below does not
compile in RAP.
If (FileExists(doc_image['URL_PATH'])) then
Image1.Picture.loadfromfile(doc_image['URL_PATH']);
Can anybody help me please.
Many thanks in advance
Mark
This discussion has been closed.
Comments
The ReportBuilder DBImage can handles this for you automatically. Connect
the DBImage to a string datafield. The DBImage will check whether the string
value is a valid file name and load the image.
To get your code to work in RAP you need to extend RAP by adding the
FileExist function to the RAP CodeToolbox.
--------------------------------------------------
Article: Extending RAP
---------------------------------------------------
There are two very simple and powerful techniques to extend the capabilities
of RAP infinitely. These are summarized below and covered in more detail in
the RAP.hlp online help. Demos and tutorials are installed to
RBuilder\Demos\RAP. The tutorial text is located in RAP.hlp.
1. RAP Pass-Through Functions
These are functions that appear in the Language tab of RAP's Code Toolbox.
These functions are written in Delphi and can be called from RAP. RAP's
pass-through function architecture enable's developers to add new built-in
functions to RAP's code toolbox.
2. Extend RAP's RTTI
RAP's Run-time Type information defines what classes and properties can be
accessed via RAP. By default the published properties of any class that is
registered with Delphi's RegisterClass procedure is recognized by RAP. In
addition many of the public properties and methods of ReportBuilder classes
are exposed.
--
Tech Support mailto:support@digital-metaphors.com
Digital Metaphors http://www.digital-metaphors.com
--
Nard Moseley
Digital Metaphors Corporation
http://www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com