One of our current projects requires enabling users to upload preload and postload validation files that are approved for a load. Importantly, the uploaded files are the audit trail for what was approved, so these MUST not be changed or overwritten.
This is how we suggest this be executed:
- Add a column to your table as nvarchar(256) called something like ‘FileName’
- Expose that column on your Horizontal or Vertical view
- Add a column property to the column with settings like the below:
- Control: “File”
- File Path: As much of the path as you can set static at design time with ## placeholder for other values from the view.
- Example: “C:\DSP\Files\#WaveID#\#ProcessArea#\”
- File Path Type: “Physical”
- File Direction: “Upload Only”
- Add a DCV to the page that will disable the FileName column after an upload has happened. When an upload happens with a file control, the DSP writes the full path of the file to the column in the database that has the file control property. Here is some sample text for the DCV:
-
SELECT ID, CASE WHEN filename IS NULL THEN 1 ELSE 0 END AS FileName
FROM dbo.ttAddress - If you want the users to be able to download the file then alias the FileName column as a different name, and set that to be a ‘Download Only’ File control.
Following these steps should enable the user to:
- Upload File -> Save into a specific directory (dynamic based upon some other attributes, e.g.: Wave, Data Object, Load Cycle, etc.).
- Upload File -> Prevent Overwriting a file that already exists in folder directory.
Please comment below with any questions.
Comments
0 comments