Solved

Create SQL Table for a SmartObject with Attachment

  • 20 July 2023
  • 1 reply
  • 141 views

Badge +3
  1. I create a table in SQL database. This table will be generated to a SmartObject by SQL service instance.
  2. I generate the SmartObject through Service Instances. 

     

  3. I find that in the SmartObject created, the field Attachment is of Memo type.
  4. Because of this, the attachment field is not loaded properly in the form. (A string instead of a file)
  5. I finally change the data type of Attachment from Memo to File. Then the attachment can be saved properly. 
    But for the old data, the database saved the attachment in the wrong way and now the file cannot be downloaded.

     

 

Is this because I set the datatype incorrectly in the SQL table? Is it required that I need to manually change the data type from Memo to File?

icon

Best answer by TinTex 20 July 2023, 21:53

View original

1 reply

Userlevel 3
Badge +10

The structure for a SQL table attachment will be as follow:

SmartForms Attachment Control → SmartObject (File Type) → Service Object (Memo type) → SQL Table (nvarchar(max) type)

 

So you will want to create a column with nvarchar(max) type in SQL because the SmartObject generated it will default to Service Object (Memo type) and SmartObject Object (Memo type).

 

So you will want to edit the SmartObject and change this SmartObject Property to a File type instead.

 

I would NULL out this column for all records in the SQL table first, before changing types, refreshing service instances, updating SmartObject properties otherwise you may see errors when changing types.

 

Although storing file in SQL can be done, having a lot of files or large files can result in performance issue unless there is an archiving/clean up process afterwards.  Another possible implementation is storing file in another system like SharePoint or one of the cloud storage solutions that uses JSSP, and then linking to that via ID or download link:

https://help.nintex.com/en-US/k2cloud/userguide/current/Content/Extend/JS-Broker/JSServiceBroker.htm

https://gallery.nintex.com/search?search_term=cloud&capability=10001&industry=&department=&partner=&capabilities=&sortBy=&currentPage=1&aggregation={%22capabilities%22:[%2210001%22]}&index=[%22Nintex%20K2%22]

Reply