cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

Insert all the uploaded rows in external database

svisveswaraiya
17-Peridot

Insert all the uploaded rows in external database

Hi,

I am uploading a excel file with 10 rows using file upload widget and after uploading I am giving the all data to insert into external database. But when I upload only the first row of the excel gets inserted. How can I insert all the rows of the uploaded excel directly after uploading? 

Below is the query I am using for upload:

var params = {
path: path/* STRING */,
columnMappings: "org_name;org_desc" /* STRING */,
hasHeader: true /* BOOLEAN */,
longitudeField: undefined /* NUMBER */,
dateFormat: undefined /* STRING */,
fileRepository: "SystemRepository" /* THINGNAME */,
latitudeField: undefined /* NUMBER */,
fieldDelimiter: ","/* STRING */,
stringDelimiter: '"' /* STRING */,
dataShape: "Bobcat_UploadOrg_DS"/* DATASHAPENAME */
};

// result: INFOTABLE
var result = Resources["CSVParserFunctions"].ReadCSVFile(params);

 

Thanks in advance,

Shalini V.

1 REPLY 1

This code seems to create an infotable out of a CSV file, I don't see the actual insertion here.

You can either iterate and insert row by row, or transform the infotable to insert all at once.

I honestly don't know exactly what format you need to insert multiple lines at once into a Database but if it is just a repeat of the value rows, you can iterate and create that string and add that to your sql.

you may have to use string substitution vs. parameter substitution.

Announcements

Top Tags