Extract data from a file and store in the Database.

Hello,

I'm new to Outsystems.

I'm trying to create a project to read the data from a file and save it to the database and will separate the data into different columns using the separator mentioned by the user.

Basically, the user has to mention the separator when he uploads the file.


Any help would be appreciated. 

Thanks!

-Madhu







Madhumathi Kannan wrote:

Hello,

I'm new to Outsystems.

I'm trying to create a project to read the data from a file and save it to the database and will separate the data into different columns using the separator mentioned by the user.

Basically, the user has to mention the separator when he uploads the file.


Any help would be appreciated. 

Thanks!

-Madhu







Hi Madhumathi,


First you have to use string_split action (text will be your sting and delimiters will be separator given by users). 

this action will split the string on the basis on separators, then use string_split.list[0].text.value  to store in first column and so on.

hope it helps

Regards

Seema


Hi Madhu,

What kind of file you want upload to store in the Database?

Cheers,
Nuno Vedasca

Please, check this information, I believe that you will found all you need:

Cheers,
Nuno Verdasca

Nuno Miguel Verdasca wrote:

Hi Madhu,

What kind of file you want upload to store in the Database?

Cheers,
Nuno Vedasca


It can be any file. As of now I want to try with a .txt file.

-M



Seema Pandey wrote:

Madhumathi Kannan wrote:

Hello,

I'm new to Outsystems.

I'm trying to create a project to read the data from a file and save it to the database and will separate the data into different columns using the separator mentioned by the user.

Basically, the user has to mention the separator when he uploads the file.


Any help would be appreciated. 

Thanks!

-Madhu







Hi Madhumathi,


First you have to use string_split action (text will be your sting and delimiters will be separator given by users). 

this action will split the string on the basis on separators, then use string_split.list[0].text.value  to store in first column and so on.

hope it helps

Regards

Seema


Sure. I'll try it. Thank you!

 But would you have any sample oml to refer?

Thanks!




So, please, look to this documentation:

Cheers,

Nuno Verdasca


Madhumathi Kannan wrote:

Seema Pandey wrote:

Madhumathi Kannan wrote:

Hello,

I'm new to Outsystems.

I'm trying to create a project to read the data from a file and save it to the database and will separate the data into different columns using the separator mentioned by the user.

Basically, the user has to mention the separator when he uploads the file.


Any help would be appreciated. 

Thanks!

-Madhu







Hi Madhumathi,


First you have to use string_split action (text will be your sting and delimiters will be separator given by users). 

this action will split the string on the basis on separators, then use string_split.list[0].text.value  to store in first column and so on.

hope it helps

Regards

Seema


Sure. I'll try it. Thank you!

 But would you have any sample oml to refer?

Thanks!




Hi Madhu

Please check the attached oml. Shared a small example, where on uploading text file, initially it will convert binary to text and then data will be split on the basis of "," and stored on  database entity using textcreate action.

you can customize this according to your need.


hope it helps.


Can you give a file example, please? 

I found a problem because I tried to submit a file, and when it converts it to text, and then splits it, I get more than 3 values in the structure. But still I would like you to send me a sample file that you want to submit, and if this file only really has after Split a structure with size 3 !?

Another problem that I found in your OML, is that you have the size of the attribute too small, it was 50.



Madhumathi Kannan, do you see my comments?

This is because I can write the data, although I do not understand what you want to do, the problem is even with the size of the attributes of the entity.

Seema Pandey wrote:

Madhumathi Kannan wrote:

Seema Pandey wrote:

Madhumathi Kannan wrote:

Hello,

I'm new to Outsystems.

I'm trying to create a project to read the data from a file and save it to the database and will separate the data into different columns using the separator mentioned by the user.

Basically, the user has to mention the separator when he uploads the file.


Any help would be appreciated. 

Thanks!

-Madhu







Hi Madhumathi,


First you have to use string_split action (text will be your sting and delimiters will be separator given by users). 

this action will split the string on the basis on separators, then use string_split.list[0].text.value  to store in first column and so on.

hope it helps

Regards

Seema


Sure. I'll try it. Thank you!

 But would you have any sample oml to refer?

Thanks!




Hi Madhu

Please check the attached oml. Shared a small example, where on uploading text file, initially it will convert binary to text and then data will be split on the basis of "," and stored on  database entity using textcreate action.

you can customize this according to your need.


hope it helps.


Hi Seema,

Thank you for the solution!!

It was very helpful.

One more query: what if I wanted the columns to be generated in runtime.

Thanks,

Madhu



Nuno Miguel Verdasca wrote:

Another problem that I found in your OML, is that you have the size of the attribute too small, it was 50.




Hi Nuno,

You can ( customize) change the length and number of an attribute according to your requirement. This is just a small example to explain, how do I extract data from a file and store in the Database.

Regards 

Seema

Nuno Miguel Verdasca wrote:

Madhumathi Kannan, do you see my comments?

This is because I can write the data, although I do not understand what you want to do, the problem is even with the size of the attributes of the entity.

Hi Nuno,

Thank you, Nuno for the inputs! 

My requirement is that I should be able to upload a file and state a delimiter. Based on the delimiter the data should be separated and saved in the database.

I would want to generate the columns of the database at runtime.

Thanks!


Hi Seema, 

Thank you so much for your transmission of knowledge. I appreciate that very much.
Cheers,
Nuno Verdasca

Hi Madhu,

I don't know if there is a way to add attribute to an entity at runtime. But you can check the following link, it may help you to resolve your query:

https://www.outsystems.com/forums/discussion/33087/add-attributes-dynamically-to-the-entity/#Post114725

Nuno Miguel Verdasca wrote:

Hi Seema, 

Thank you so much for your transmission of knowledge. I appreciate that very much.
Cheers,
Nuno Verdasca

Thank you Nuno Verdasca :)


Seema Pandey wrote:

Hi Madhu,

I don't know if there is a way to add attribute to an entity at runtime. But you can check the following link, it may help you to resolve your query:

https://www.outsystems.com/forums/discussion/33087/add-attributes-dynamically-to-the-entity/#Post114725

Hi Seema,

With reference to your solution I tried developing this, but am not able to save the data into the database.

I'm making a mistake somewhere. Is it possible that you can point what's wrong. I have attached my oml.

Thanks!


Solution

Madhumathi Kannan wrote:

Seema Pandey wrote:

Hi Madhu,

I don't know if there is a way to add attribute to an entity at runtime. But you can check the following link, it may help you to resolve your query:

https://www.outsystems.com/forums/discussion/33087/add-attributes-dynamically-to-the-entity/#Post114725

Hi Seema,

With reference to your solution I tried developing this, but am not able to save the data into the database.

I'm making a mistake somewhere. Is it possible that you can point what's wrong. I have attached my oml.

Thanks!


Hi Madhu

1. method should be submit and destination should be save action.

2. Make sure to check the length of your attributes

3. If still you are not able to save data, use debugger and check the flow, that where you are getting error.


Solution

Seema Pandey wrote:

Madhumathi Kannan wrote:

Seema Pandey wrote:

Hi Madhu,

I don't know if there is a way to add attribute to an entity at runtime. But you can check the following link, it may help you to resolve your query:

https://www.outsystems.com/forums/discussion/33087/add-attributes-dynamically-to-the-entity/#Post114725

Hi Seema,

With reference to your solution I tried developing this, but am not able to save the data into the database.

I'm making a mistake somewhere. Is it possible that you can point what's wrong. I have attached my oml.

Thanks!


Hi Madhu

1. method should be submit and destination should be save action.

2. Make sure to check the length of your attributes

3. If still you are not able to save data, use debugger and check the flow, that where you are getting error.



Thank you so much, It helped!