Download uploaded attachments from Database SMO

  • 2 February 2017
  • 3 replies
  • 88 views

Badge +2

Hi everyone,

 

I need assistance on displaying stored attachments in a list view and it must be clickable so that the user can download it for reference. I currently have a SmartObject connected to a stored procedure, and fetches the items via a unique employee number. I can see it stores it as XML but for the life of me I cannot get it to download from a smartform. What can I do to accomplish this as it is a requirement for the client.

 

Thanks!


3 replies

Userlevel 5
Badge +18


 


I believe this may just involve returning this nvarchar(max) column with the data. It will surface as a Memo type if SmartObject generated and if so change it to a 'File' type, otherwise create a SmartOBject with the 'File' type.  Store procedure method should return this column to the 'File' type, then a List view can be generated from this SmartObject.

Badge +2

Hi tin,

Did the exact steps in your example and I can return the file contents but the link to download it is blank in the list. I changed it to File like you said but to no avail. I attached images to see maybe I missed something





Userlevel 5
Badge +18

Hello,


 


I do see a difference in the data that is stored in the database; this is likely the culprit, although I am not sure how your XML was added:


 



<collection><object><fields><field name


 


 


I believe if you were to create a SmartBox type SmartObject with a File type, it would be stored as:



<file><name/><content/></file>


 


Now that the SmartObject have the 'File' type, if you were to upload another document; does the XML stored in the DB changes?  Perhaps how these file were added prior cannot be handle with the File type and as such these rows needs to be deleted and the file reuploaded.

Reply