Import (Bootstrap) Excell - Data Types turn into Integer instead of Text

Hello,

I have an Excell, with atributes that are ID's. In Excell the cell is formated as Text and I have "01", "02" and so on... as Text (without the "", just the numbers). When I import to Outsystems, I can see in the bootstrap that the data type is changed to Integer. And it drops the leading zeros in the data, so de "01" becomes just 1, the "02" just 2 and so on...

How can I fix this?

Hi Frederico,

Are you creating the entity using the excel, or the entity already exists and you are just bootstraping it?

If it is the first, I don't think you can do anything about it... As the platform will try to infer the data type from the information, not from the "style" applied... (I think).

If you create the entity before and give the attribute with a Text data type, it should work...

Cheers.

Eduardo Jauch wrote:

Hi Frederico,

Are you creating the entity using the excel, or the entity already exists and you are just bootstraping it?

If it is the first, I don't think you can do anything about it... As the platform will try to infer the data type from the information, not from the "style" applied... (I think).

If you create the entity before and give the attribute with a Text data type, it should work...

Cheers.

Hey Eduardo. It's the first option you mentioned, creating entity with Excel. I can try the second, but is it possible to create the entity in Outsystems and then populate it with data from excell?


Hi Frederico Milheiro,

I've made it work on my side by (assuming you are using an external ID, not the entity identifier):

1) Bootstrap the excel file to create the entity, structure, action, and timer

2) Go to the entity and structure to change the ID type (assuming that you want an ID external)

3) See the result with debugger 

Solution

Hi, 

Yes.

After creating the entity, click on it with the right button of the mouse and go to Advanced and bootstrap from excel.
Then choose your excel file. It will show the matching between the excel columns and your entity attributes (the entity name and the excel column label must be an exact match).

Cheers.

Solution

By the way, I never use the creation of the entity from the excel.
I prefer to create the entity first, with the correct attributes, labels, data types, Mandatory indication, etc. instead having to check everything after and change bootstrap logic.

Marco Arede wrote:

Hi Frederico Milheiro,

I've made it work on my side by (assuming you are using an external ID, not the entity identifier):

1) Bootstrap the excel file to create the entity, structure, action, and timer

2) Go to the entity and structure to change the ID type (assuming that you want an ID external)

3) See the result with debugger 

Hey Marco,
Thanks for the reply. I don't understand how you did it? I'm using the outsystems identifier for the entity identifier, but then I'm using other atributes that have text with leading zeros. Does are the atributes that when I bootstrap, the outsystems remove the leading zeros and turn the data type into Integer.


Eduardo Jauch wrote:

Hi, 

Yes.

After creating the entity, click on it with the right button of the mouse and go to Advanced and bootstrap from excel.
Then choose your excel file. It will show the matching between the excel columns and your entity attributes (the entity name and the excel column label must be an exact match).

Cheers.

Hey Eduardo, I'm going to try it. I'll let you know in a few minutes


Frederico Milheiro wrote:

Hey Marco,
Thanks for the reply. I don't understand how you did it? I'm using the outsystems identifier for the entity identifier, but then I'm using other atributes that have text with leading zeros. Does are the atributes that when I bootstrap, the outsystems remove the leading zeros and turn the data type into Integer.

Let me explain what I've did:

1) My excel file contains an ID column with values as "0041".
2) Bootstrap automatically created a timer, action, structure, entity.
3) In the entity changed the type of ID to text:
4) Same in the structure:5) Adapted also the action assign because of the type:

6) Published and saw in the entity the values uploaded (similar to excel):

Does this help? Cheers!

Eduardo Jauch wrote:

By the way, I never use the creation of the entity from the excel.
I prefer to create the entity first, with the correct attributes, labels, data types, Mandatory indication, etc. instead having to check everything after and change bootstrap logic.


Eduardo, I'm having trouble to make it work. Seems when I create the entity first in outsystems with the atributes, and then use the Advance > Boostrap from excell, It then shows two columns, one with the entity I created and other with the entity of excell, and both columns have the same atributes, I think i means it will relate those atributes from excell to the entity in outsystems. But after finishing, the records don't seem to be populated with any data. I try to do searches in an Agregate with the Entity and doesn't return any values.

The bootstrap will create a server action that will be called when you publish the module. The entity must be empty for it to put something there. 

You can take a look in service center to check for errors. If you find one related with the bootstrap timer, put here the detail of the error. 

Eduardo Jauch wrote:

The bootstrap will create a server action that will be called when you publish the module. The entity must be empty for it to put something there. 

You can take a look in service center to check for errors. If you find one related with the bootstrap timer, put here the detail of the error. 

Eduardo, it doesn't seem to retrieve any errors. Also, I think the Entity is populated because when I double click it and go to the tab "Examples" it has a example record. So... Maybe you can help me checking what I'm doing wrong. Here is a print screen:

I've tried with that filter, also with "CP.Nome_Localidade = Procura" . Procura is a local variable (Text)
The small window in the left is the filter in the agregate GetCps, and the small window in the right is the CP entity, showing the example record. When I search for that record in test values, it doesn't work.
Also tried to just search "Alca" or "Lis" or "Lisboa", but doesn't work.

But, I think the data is right. Because in the example it shows de Codigo_distrito and Codigo_localidade with leading zeros (01), meaning it's preserving the zeros. And those atributes are TEXT data type. So the way you said, it worked. I just can't seem to make the filters work now.

Hi Frederico,

First, see if you really have data in the entity.
To do so, right click the entity and in the context menu select View Data. This will show the entity and if it has data, you will see it (or part of it).

Cheers.

Eduardo Jauch wrote:

Hi Frederico,

First, see if you really have data in the entity.
To do so, right click the entity and in the context menu select View Data. This will show the entity and if it has data, you will see it (or part of it).

Cheers.

Hey Eduardo. If I right click the entity and go to "View Data" option, it opens the entity and a table with the atributes but it says "No Records to Show". It doesn't have any filters.


So, you don't have records, and the bootstrap failed for some reason.
Can you provide your OML so I can check it? You can attach the OML in a post here.

Eduardo Jauch wrote:

So, you don't have records, and the bootstrap failed for some reason.
Can you provide your OML so I can check it? You can attach the OML in a post here.

I would, but I don't know how. Also this is a WebApp with 2 Modules (one for interface, other for BD)


Frederico Milheiro wrote:

Eduardo Jauch wrote:

So, you don't have records, and the bootstrap failed for some reason.
Can you provide your OML so I can check it? You can attach the OML in a post here.

I would, but I don't know how. Also this is a WebApp with 2 Modules (one for interface, other for BD)


Eduardo I think I know why it is failing, I've changed the data type of Codigo_Concelho and Codigo_Distrito in the CP entity, they were Text, and I changed it to Concelho Identifier and Distrito Identifier. This might be why it doesn't load the data. Because the Distrito entity, where I didn't change anything, it's populated. 


Hi Frederico,

Probably. But this should cause a message in the Error Log in Service Center.

Just go to the application page (where you can see the modules). At the top you have an option to download the application. It will download an OAP file.

Just attach it here.

Cheers.

Eduardo Jauch wrote:

Hi Frederico,

Probably. But this should cause a message in the Error Log in Service Center.

Just go to the application page (where you can see the modules). At the top you have an option to download the application. It will download an OAP file.

Just attach it here.

Cheers.

Ok. Just a min. Let me try to not change those atributes


In any case, I have here some instruction on how to change the bootstrap logic and structure when you need to bootstrap records that have FKs to other entities.

https://www.outsystems.com/forums/discussion/48480/bootstrap-foreign-keys/

Frederico Milheiro wrote:

Eduardo Jauch wrote:

By the way, I never use the creation of the entity from the excel.
I prefer to create the entity first, with the correct attributes, labels, data types, Mandatory indication, etc. instead having to check everything after and change bootstrap logic.


Eduardo, I'm having trouble to make it work. Seems when I create the entity first in outsystems with the atributes, and then use the Advance > Boostrap from excell, It then shows two columns, one with the entity I created and other with the entity of excell, and both columns have the same atributes, I think i means it will relate those atributes from excell to the entity in outsystems. But after finishing, the records don't seem to be populated with any data. I try to do searches in an Agregate with the Entity and doesn't return any values.

I see it Eduardo. Thanks a lot! I managed to make it work, with the solution you gave me previously. For now I won't use them as foreign keys cause I can just match them as text in the filter.

Thanks a lot! Best Regards.


Hi Frederico,

I am glad that is working.

In any case, I would re-think using the IDs as text. Having them as proper identifiers (FKs), it would probably have a noticeable impact on the application performance...

The bootstrap and changing the bootstrap is seen in the Web Development online training. If you didn't it yet, I recomend.

Cheers!