Upload an excel file (end-user) to create records in the database.

I currently am assigned for a task, where i need to provide the end user with the capability to upload an excel, which only has 3 attributes that need to be saved, like exactly matching the attributes in the Database.

I clearly have no clue on how to even start. Besides the upload widget.


mvp_badge
MVP

Hello Henrique.

What you want is to bootstrap the data.

Here you have a step by step manual and video

https://success.outsystems.com/Documentation/11/Developing_an_Application/Use_Data/Bootstrap_an_Entity_Using_an_Excel_File


Hi Nuno, 

Thank you for your help, but this is not exactly what i am looking for.

I need to allow the end user (lets say a manager) to upload an excel file.

And then only add data to already existing entities.

mvp_badge
MVP

It's almost the same.

  • You upload the file.
  • Do a Excel to Record List targeting the entity as "Record Definition".
  • Then do a create for each row of that list.

If the columns match, the rows will be written to the table.


It would be great if you could explain step-by-step how to do this.

How do you "Do an Excel to Record List targeting the entity"?

How do you "Do a create for each row"?

Thanks

Paul - very new to outsystems

Hi Henrique,

I placed a sample OML file for your problem's reference. Please look into it. 

As you said enduser will upload the file, Please try to maintain proper record definition (Entity or structure) so the values uploaded from the excel file will be bootstrapped into DB properly. 

URL : https://saravanan-gamechanger.outsystemscloud.com/TEST/Upload?_ts=637564713905386441

for the example attached record defn contains name and age attribute.

Thanks,

Saravanan 

TESTEXCEL13052021.oml

Hello Henrique,

1. you should use a upload widget for getting the excel file.

2. Convert the excel into record list using exceltorecord widget available in OS.

3. Compare the attributes of the record list with the attributes of your expected output.

4. Once the attributes are correct, you can loop inside the record list and insert the records into respected entity.


Hope this helps!


Thanks,

Krunal

Hello Henrique, 

I have provided solution & steps to upload an excel, which only has 3 attributes that need to be saved in OS database, like exactly matching the attributes in the Database.

Follow the below steps and refer the attached oml file to achieve your requirement, also use the attached excel for testing.

For Traditional: [https://andrew-ajay.outsystemscloud.com/ExcelUpload/Upload.aspx]

  1. Use upload widget & a button to upload the excel in the screen in service studio.
  2. In the screen action of the upload widget use a ExceltoRecord widget & map the record definition as [Target table name] & file content as  Upload.Content
  3. Use a For loop condition[Map Record list as ExcelToRecordList1] followed by a create server action[Map source as ExcelToRecordList1.Current]

For Reactive: [https://andrew-ajay.outsystemscloud.com/ExcelUploadReactive/Upload?_ts=637582875208450998]

  1. Use upload widget[Map file content with a local variable as Binary data datatype and File name with a local variable as Text datatype] & a button to upload the excel in the screen in service studio.
  2. Create a server action inside the client action with a input parameter with data type as binary data
  3. Use a ExceltoRecord widget & map the record definition as [Target table name] & file content as  server action Input parameter
  4. Use a For loop condition[Map Record list as ExcelToRecordList1] followed by a create server action[Map source as ExcelToRecordList1.Current]

Note: The uploading excel header title should have the same name as the attribute has, if the title is different an empty value will be stored.

Regards

Ajay A

ExcelUpload.zip

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.