Import excel to a local variable
Question
Application Type
Reactive

Is there way to import an excel file to a local list variable instead of a database entity?


>Import Excel to a local list variable

>The data from the local list variable will be visible at the screen on a table widget.

>The table is a data validation screen that is going to show errors with the data based on conditions, if all the data is fine the user will be able to press the button and insert the data from the local list variable to the database entity.


Solution

You just need to do the bootstrap in the data action that will retrieve the data you want. When you import your excell you will read the excell and you loop through the data and you will append to a variable in the data action. Then after fetch on the date action, you append all to the variable on your screen if you don't want to use the output from the data action.

Steps:

1-Import the excell to the database create an entity.

2- You will see the bootstrap that was created and also the entity

Dont forget to change your bootstrap to assign the output from the excel to the output that you must create


3-On the screen you create a data action

4-Inside of the data action call the bootstrap that was created

5- You create an output for the data action with the data type of the entity/structure that you are going to create if you want and assign the output from the bootstrap and assign it to the output of the data action that you created.

6- Create a data fetch

7- Assign the output from the data action with the list of records, to a variable that is going to keep the records and show on the screen.

Then all the other steps you will have the data to show on the screen. And then after the screen, it will be possible to loop that temporary list and add it to the database.

I don't know if I understand, but just to cover another option:

If you want to upload an excel on your screen you just need to use the upload widget and you will have a variable that will hold the binary data of the file you are uploading, then you just need to create an input parameter in the bootstrap that will receive the binary data and you will assign here.

Like this

Have a look at the OML

ListOfRecordsFromExcell.oml

Worked very great, thank you!!

Hi @Kaio Patrick

As per your question, I understand that without using of any database entity you need to add (Bootstarping) your excel data into a local variable list and that data should be shown in the table.

If yes, Here is the solution.

1.  Uploads widget for selection of your excel.

2. create one structure of type to store different different attributes.
for example : I created one structurer of NAME, AGE, GENDER.


3. Add Data action to store the selected excel sheet data into the local variable.
Here I'm directly passing the excel sheet into list of local variable without using any DATABASE ENTITY.


4. Add table to the screen and source is of Data action's output of created structure.



Please find the below attached OML for your reference. and the link.

Link : DEMO Link

Result :

I hope this helps and you'll found a solution  for your requirement, Please acknowledge the same.

- Palle Vijay Bhaskar Reddy.

Excel into local.oml

Very nice Vijay, I'm going to consider the first answer as solution since it's the same method which I think is fair but this one is definitely a faster way, straight to the point. Thank you very much.

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