Importing data from csv file

  • 5 September 2012
  • 5 replies
  • 31 views

Badge +2

Is it possible via smartforms to upload a CSV file and use it to import data into a smartobject?


If so, how to do that?


5 replies

Badge +5

What is the exact scenario?  CSV into oracle, ms sql, access,?  How current does the data need to be.  I know I've seen some "execute a smartform method" type actions in the newest build, but I'm not sure what you are trying to do.  I'd happily throw some ideas around with but, but will need a bit more info.


-Brian


Badge +2

I made a smartobject containing new employees. If there's just one, then it will be easier for the user to just enter the data for that person (name, email etc).


 


But sometimes he'll get a whole list of new people, and they arrive as a CSV file. Instead of typing them in, it would be nice if there was an upload button and then K2 should take the CSV and insert all the new people into the smartobject list. The smartobject use the default datasource (where things end up inside K2's own databases somehow - I'm not sure where the data go except "somewhere in the MSSQL db that K2 uses".

Badge +5

Personally I'd just go into the database...
If you open SQL Server Management Studio, the smart object creator makes a table under the K2 Database.  Should be the same name as your smart object.  Check out http://blog.sqlauthority.com/2008/02/06/sql-server-import-csv-file-into-sql-server-using-bulk-insert-load-comma-delimited-file-into-sql-server/ to see how to do the CSV insert.


If you are more a front end guy, the best I've found is making an editable list view, but you can't (bulk) paste into that.  If you have access to SharePoint, you can make a list your data source, and then paste into the list in data sheet view.


The other best answer I can give you is to create a "new employee form and workflow" so that you are not getting a list of new employees, but rather are leveraging K2 to help with on-boarding.  That way instead of trying to import data you would be helping create and manage it.


 

Badge +4

Elveejay,


There's no mechanism built into smartforms to parse a CSV.


I would add a file attachment control to your form and build a BlackPearl workflow behind the form. When the user submits the form (and the attachment), the workflow would grab the appropriate attachment and do the insertions behind the scenes. This way, you could write code and do whatever other processing is necessary on the CSV to make sure it is done correctly.


HTH,


Tyler

Badge +5

To piggy back on Elveejay, you can use that sql code and have blackpearl run it.


 

Reply