Home Search

DriveWorks Pro 21

Send Feedback


Retrieves a URL for the given file to be displayed in a browser. This resource URL can be used in a Web Frame Control or a Hyperlink Control to display or download the specified file.

Files types like PNG, JPG, PDF and HTML will display in a web browser. They will display in a new tab or a Web Frame control. Files like SLDPRT, DOCX, XLSX and ZIP cannot be displayed in a web browser and will be downloaded to the client's machine.


FsGetUrl([File Location],[Always return URLs])


File Location is a path to the file to be displayed in a browser.

If this is not a full path then it shall be treated as being relative to the Project's location during design time, and relative to the Specification directory otherwise.

Always return URLs (optional) If set to TRUE, then a URL will always be returned, rather than desktop versions of DriveWorks returning the local path that was given in. This is FALSE when not set.

This function will not automatically update. To update the function, one of the arguments must change to re-trigger the function.

Example (Full File Path)


FsGetUrl("C:\DriveWorks\Specifications\Trailer 0001\BOM.html")This will return a resource URL (for example https://resource/be51477595c7498394193a2b062dc710/BOM.html) when used in a Web Frame Control or Hyperlink Control in a browser.

This will return the full Windows file path in desktop applications (DriveWorks Administrator, DriveWorks User, etc.)

Example Outcomes

FsGetUrl("C:\DriveWorks\Specifications\Trailer 0001\BOM.html", TRUE)https://resource/be51477595c7498394193a2b062dc710/BOM.htmlThe file has been found in the location and a resource URL has been returned.
FsGetUrl("C:/DriveWorks/Specifications/Trailer 0001/BOM.html")#VALUE!The path to the file is invalid. It contains / in the file path which is an invalid character.

Example (Relative File Path)

Paths relative to the Project location can be declared in the following ways:


FsGetUrl("BOM\BOM.html")During design time (for instance when building a rule in DriveWorks Administrator):

When the Project is located in D:\DriveWorks Project, the path D:\DriveWorks Project\BOM\BOM.html will be returned.

During the running of a Specification:

When the Default Specification Folder is located in D:\DriveWorks Project\Specifications, the path D:\DriveWorks Project\Specifications\BOM\BOM.html will be returned.

FsGetUrl("<Project>BOM\BOM.html")When the Project is located in D:\DriveWorks Project, the path D:\DriveWorks Project\BOM\BOM.html will be returned.

Handling an Error

FsGetUrl results in a #VALUE! if the file does not exist or if the path contains invalid characters.

This can be handled by nesting the function inside an IfError function. This will handle the error and allows you to display an alternative value or file. For example, you could show a file not found image on the control.