Skip to main content

Hello,

 

We have a requirement to validate the contents in an uploaded txt/csv/xls file to check maximum number of rows and value in each row should be of 11 digits.

It would be really helpful if anbody could let us know how can this be done in smartforms or perhaps smartobject/workflow.

Dear ,

 

Please check the following link http://help.k2.com/onlinehelp/k2smartforms/userguide/current/default.htm#sf_-_viewcontrols_-_file_attachment.html

expand K2 designer --> Controls --> File attachment

there is explinations about how to define the size and type of the control ,

also there is a property in the file attachment control properties pane on designer that says "Max file"

 

Hope it helps!

Regards.


Umar,

This might not be what you want to hear, but I believe you really only have one choice... custom code.

We have similar logic for an uploaded xlsx file that we need to "validate" using a bunch of business rules.  I looked for a while and didn't find any framework for this validation so here is what we did:

 

First we build a small stand along windows program that would validation any file with all the business rules.

Once that was working, we simply wrapped that up into a single function call that accepted a string and returned a List<string> (which was the errors)

We then simply added this using the Endpoint Assembly service broker and we were all set.

 

Now a user uploads an xlsx file and we store that in the db.  We then also call our custom method and pass in the file data.  We then get the return error messages and display those to the user.

 

It may sound intimidating, but if you can write the stand along application that validates the files, then you can very easily add that to K2.

 


Thanks for the useful replies.

 

@NathanBrown, agree, if there is no inbuit way of doing this in K2, then the better option is to have a webservice endpoint as you explained and use it in K2.

Thanks for your suggestion.


Reply