How to upload an Excel File with different data for each upload
Application Type
Traditional Web
Platform Version
11.9.1 (Build 20359)

I have set up a button to upload data from an Excel file as shown here:

The screen action flow of the button looks like this:

It calls a server action (Action6) that loads the data from the Excel file.

The UploadNewPatient references a Resource to access the data.

This all works perfectly well and the data is successfully loaded.

But (here is the question) the Resources holds the data from the Excel file on the OutSystems server (this is how it looks to me), and when a user runs the action, it always loads the same data. How does one get the Resource to access the data in an Excel file on the local hard drive?

Thank you

Leon

mvp_badge
MVP
Solution

More details about:

- Set the button to Submit;

- Create 1 field type text, in your Excel table.


Agno,  I added the additional field and it worked.

Thanks for bringing to my attention that when creating an entity to hold binary data, it must have at least one additional field.

Best regards,

Leon

mvp_badge
MVP

Hi Leon,

You stay get the File Content by your Resource, that is the same result.

Sugestion, save the binary of your file upload in Screem in some table, and Send to your Acation6 that Id,

so, get the binary by Table and put this value in Excel to recordList.

After, delete this record for not have a lot of binary in DB.

Regards.

Thank you Agno.

So, I have two tasks:  1. To access the Excel file on my hard drive;  2. To load the data into the OutSystems database.

To accomplish task 1 I added an UploadFile widget, created two local variables, UplExcelFile (the DB file that will hold the binary content) and UplExcelFileId to keep the ID of this file. See below:

I then assign the DB file content equal to the chosen upload file (Excel), create the DB file and then set the local variable UplExcelFileId to the created DB file Id.

I tested it and the Excel file is not uploading. Do you know what I am doing wrong?

Thanks

Leon


mvp_badge
MVP

Okay, after assigning UplExcelFileId, you must send this UplExcelFileId to Action6.

Are you doing this?

Hi! 

Use the "Upload" widget in your screen. 

and just code like Agno explain. 

Regards

Graça

Thank you Maria.  I will do this.

Dear Leon,


For our customers we use either filesystem or the sftp component.

Both I have good experience with and can recommend.

Usually this involves some drive that can be accessed and where the file is published around a specific time.

This does mean however that your file should be accessible from the server.

So if you have a cloud environment I would recommend creating your own sftp server and hosting the file.

If you have the on premise environment there is the possibility of creating a network drive that can be accessed.


Of course there is also the manually upload option that @Agno Silveira  stated.


Kind regards,

Alexander

Thank you Alexander.  This is a good solution. However, I want to try the manual approach first.  Later I will upgrade to this better solution.

Regards,

Leon

Yes Agno, I am doing this.  I must first get through the first stage, which is to save the uploaded file to the DB.

mvp_badge
MVP

Can you share an image the flow in Action 6 and the parameters of the ExcelToRecordList, please?


mvp_badge
MVP

When you debug, what happen after Excel to Record List ?

error happens, or returns an empty list?


Can you share your .OML?

Agno,

There are no errors but the excel file data is not loaded to the server DB.

mvp_badge
MVP

Check if your LoadPatient.Id is set = nullidentifier()


Can you see in the list that is returned from "ExcelToRecordList" widget in the debug?

You are looking ahead in the process.  It seems to me that the UploadFile is not uploading the file.  The user chooses the file to upload and clicks "Upload".  This widget is not loading the file.  We must get this to work first before we can test the balance of the process. 

mvp_badge
MVP

Right, for that, you need to create at least one text field in the table that saves the binary.

Regards.

mvp_badge
MVP

Leon, 

I created an .OML example, with functionality similar to what you need, see the details of how I did it.

Hope this helps.



TestExcel.oml

mvp_badge
MVP
Solution

More details about:

- Set the button to Submit;

- Create 1 field type text, in your Excel table.


Agno,  I added the additional field and it worked.

Thanks for bringing to my attention that when creating an entity to hold binary data, it must have at least one additional field.

Best regards,

Leon

mvp_badge
MVP

Glad it worked, I'm happy to help.

Best Regards.

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