Skip to main content

Dears 


We have a case where we want to upload multiple attachment per one smart object record , so a smart object record/row can have multiple related attachments , is there any OOTB support for such scenario ?  

Hi,


 


That's a One-to-Many relationship. Assume that your 'Many' entity (smartobject smartbox) has the following attributes:


ID - Auto Number


Attachment - File


ForeignKey - Number


 


and your 'One' smartobject smartbox:


ID - Auto Number


Department  - Text


 


You can create an editable list against your 'Many' smartobject smartbox. This will allow you to add a binary file for each row added - I'm assuming you are using K2 SF 1.0.4 as it supports file upload control on editable lists.


Then, on your save button, where you call the actions to create/save changes on the editable list, you will configure and specify the ForeignKey value with the ID of the 'One' smartobject smartbox.


 


Hope it was helpful.


 


Cheers,


Tiago


Hello Guys,


I have a similar kind on requirement like i want to upload multiple files (dynamic count) to database or SharePoint list/doclibrary. Please let me know if anyone had worked on this. Ideas much appreciated.


Hi Srikanth,


 


If you want to store the files into SQL database, create a dll or a web service which will upload the file into SQL DB, register the service type and build the smartObject which will take the file path as input and will store the files content to DB.


Once yoour smartobject is ready, create a view of list type, while selecting the method use the smartbox methog GETLIST.


The list is of editable type, drag and drop the file attachments control.


 


Now you should be careful while designing the rule,


 


when you click on Save Button


execute the custome smartobject you have desinged to store files to DB


 


Thats it:)


An out of hte box approach would be to create a column in your SQL database and set the type to nvarchar(max). Create your SQL Service broker instance against this database. 

 

When you create your smartobject definition, it is going to create this property as Memo, but you will want to create your file property manually and set it to type of file. Then, when you add files via SmO it will be saved in your database.

 

The only caveat that I can think to mention about this step is that the files uploaded to your database will be in K2's file format, but if you are only using these files with a Smartforms based application you will be set.


Hi,

 

I can save the file attachment (.csv) to sql database by using SMO method. The attachment link is now as <file><name> </name> <content> </content></file>.

But now i wish to convert back attachment link to file. May i ask any methods that i can convert the attachment link back to the file that i want?

 

Thanks & Regards,

Kyo.


Hi,

 

The data you see inside the <content> tag is basically encoded base64(not K2 proprietary format) so you can always convert it back to a file if required. However, if you are always going to be using smartfoms control file controls then when you load that file into the file control it will automatically becaome a link. when you clcik it it will download.

 

If you are not going to be using smartforms and want to foe example show the file on a .aspx page then you will have to use .net library to convert the base 64 encoded part into a file. It's fairly straight forward. If this is what you require, I can provide a more comprehensive guide asI have done this before.

 

Hope this helps. 


Hi,

 

i need to upload multiple files in File sytem(Specified location of server). how to upload?

 

Please help me on this.

 

Thanks,

Sankara Ganapathy


Reply