Skip to main content

I need to import data from csv file into K2 blackpearl listview. Anyone has any suggestions?

Hi,


 


You can check this out:


https://community.k2.com/t5/K2-Cloud/Import-CSV-file-data-into-List-View/td-p/105590


 


Or this:


https://community.k2.com/t5/K2-blackpearl/Excel-Import-Service-Broker/ba-p/65814?nobounce


 


You should know that for list view to display something, you must bind it to a SmartObject with a list method. Your SmartObject is tied to a service, so the SmartObject is basically retrieving results from that service.


 


The first link shows you how you can import csv into a SQL table, then you can create a SQL service instance, and create a SmartObject that references the table with the imported csv.


 


The second link is a Excel Import service broker someone created, which allows you to load Excel spreadsheet table into a  SmartObject. Not sure if this works with csv though.


 


 


Good day RanaSenhal


 


I can confirm that there is no Out-Of-The-Box functionality for this See the spoiler below for a workaround on this issue:


 


1. In SQL Server, Create a table to hold the data.
2,1. You can either use the SQL query in the spoiler below or you may follow the steps listed in 2,2.


BULK INSERT SchoolsTemp
FROM 'C:CSVDataSchools.csv'
WITH
(
FIRSTROW
= 2,
FIELDTERMINATOR
= ',', --CSV field delimiter
ROWTERMINATOR
= '
'
, --Use to shift the control to next row
TABLOCK



2,2.  These steps will import the data with the help of a configuration wizard:



  • Log in to your database using SQL Server Management Studio.

  • Right-click the database and select Tasks > Import Data...

  • Click the "Next" button.

  • For Data Source, select Flat File Source. Then use the "Browse" button to select the CSV file.  Spend some time configuring the data import before clicking the"Next" button.

  • For Destination, select the correct database provider (e.g. for SQL Server 2012, you can use SQL Server Native Client 11.0).  Enter the Server name; check Use SQL Server Authentication, enter the User namePassword, and Database before clicking the "Nextbutton.

  • In the Select Source Tables and Views window, you can Edit Mappings before clicking the "Next" button.

  • Check Run immediately and click the "Next" button.

  • Click the "Finish" button to run the package.



3. Navigate to Management and under integration click on "Service Instances".
4. Create a new Service instance for SQL and click the "Generate SmartObjects for this Service Instance" checkbox (see this link for more information).
5. on form level, link a listview on a form to the Generated SmartObject.



Please feel free to ask if the steps are not descriptive enough.


 


Hope this helps. If this does help would you please mark this post as a Kudo or Solution. this will show other users with the same problem that this post does indeed contain viable information. Thank you.


 


Regards


Jacques.


 


[K2 will not accept any liability for information by any member of this page]


 


Reply