how to import a table with a foreign key via excel bootstrap

Hello, 

I have a problem importing a table with a foreign key via excel bootstrap.

I followed these two paths:

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

2nd https://success.outsystems.com/Documentation/How-to_Guides/Data/How_to_update_a_Bootstrap_Action_to_fetch_an_entity_identifier_from_Excel

But I still haven't been successful, can someone help me?

I present the images of my application and attach the excel that I made the bootstrap

Best Regards, 

Jessica Marques




Hi Jessica,

I think you missed something , let me explan again.

1.First in your entity remove foreign  key and make it simple Integer data type column.

2. in excel file upload data with integer column and check mapping column.

3. once data bootstraped, convert datatype in entity make foregin key of column .

4.after publish you need to able see data.


Hope this will help you.


Regards

Rahul Sahu

Rahul Sahu wrote:

Hi Jessica,

I think you missed something , let me explan again.

1.First in your entity remove foreign  key and make it simple Integer data type column.

2. in excel file upload data with integer column and check mapping column.

3. once data bootstraped, convert datatype in entity make foregin key of column .

4.after publish you need to able see data.


Hope this will help you.


Regards

Rahul Sahu


Hi, 

Thanks for help, I following these paths, but when I do the path 3 one show one error:

regards, 

Hi Jessica,

I guess It was not possible to change the column type, as there is already data (zero 0) written to it. 

So, you will have to delete the column and create it again with another name and type Genre Identifier.


Regards,

Leandro.

Hello Jessica,

That error is ocurring because you have values associated to your GenreId attribute (in Work entity) that doesn't exist in the Genre entity.

For example, imagine this scenario. You have only 3 records in the Genre entity, with Ids 1, 2 and 3.

Since GenreId (in Work entity) is now an integer, you can assign any integer you like. But if you put a value that is not 1, 2 or 3, that value won't exist in the Genre table, and you will receive that error when you try to convert the GenreId attribute from an integer to a foreign key.

My advice is that you review your Excel and the values in the GenreId column, make sure that every single one of them exists in Genre entity and it should work afterwards.


Kind regards,

Rui Barradas

Jessica Marques wrote:

Rahul Sahu wrote:

Hi Jessica,

I think you missed something , let me explan again.

1.First in your entity remove foreign  key and make it simple Integer data type column.

2. in excel file upload data with integer column and check mapping column.

3. once data bootstraped, convert datatype in entity make foregin key of column .

4.after publish you need to able see data.


Hope this will help you.


Regards

Rahul Sahu


Hi, 

Thanks for help, I following these paths, but when I do the path 3 one show one error:

regards, 

Hi Jessica I see something strange here or I didn't understand well

You are trying to match a label with an integer identifier but you have integer on your excel

check this example, here you have an id and you have a label, it's  different

then you are converting an integer to an identifier (number 1 )and overwriting in the last  assign (number 2)

Do like on this pic and assign directly

Hope I could help you

Best regards

Carlos Lessa

Carlos Lessa wrote:

Jessica Marques wrote:

Rahul Sahu wrote:

Hi Jessica,

I think you missed something , let me explan again.

1.First in your entity remove foreign  key and make it simple Integer data type column.

2. in excel file upload data with integer column and check mapping column.

3. once data bootstraped, convert datatype in entity make foregin key of column .

4.after publish you need to able see data.


Hope this will help you.


Regards

Rahul Sahu


Hi, 

Thanks for help, I following these paths, but when I do the path 3 one show one error:

regards, 

Hi Jessica I see something strange here or I didn't understand well

You are trying to match a label with an integer identifier but you have integer on your excel

check this example, here you have an id and you have a label, it's  different

then you are converting an integer to an identifier (number 1 )and overwriting in the last  assign (number 2)

Do like on this pic and assign directly

Hope I could help you

Best regards

Carlos Lessa

I see that there are a lot of problems with my images above. So I restarted the process, but before,  I decided to do a test following this path

https://success.outsystems.com/Documentation/How-to_Guides/Data/How_to_update_a_Bootstrap_Action_to_fetch_an_entity_identifier_from_Excel

I created a module and entities like the explanation of the link above, but even so, I did not succeed and I can't understand why:





Best Regards, 

Jessica Marques. 




Jessica Marques wrote:

Carlos Lessa wrote:

Jessica Marques wrote:

Rahul Sahu wrote:

Hi Jessica,

I think you missed something , let me explan again.

1.First in your entity remove foreign  key and make it simple Integer data type column.

2. in excel file upload data with integer column and check mapping column.

3. once data bootstraped, convert datatype in entity make foregin key of column .

4.after publish you need to able see data.


Hope this will help you.


Regards

Rahul Sahu


Hi, 

Thanks for help, I following these paths, but when I do the path 3 one show one error:

regards, 

Hi Jessica I see something strange here or I didn't understand well

You are trying to match a label with an integer identifier but you have integer on your excel

check this example, here you have an id and you have a label, it's  different

then you are converting an integer to an identifier (number 1 )and overwriting in the last  assign (number 2)

Do like on this pic and assign directly

Hope I could help you

Best regards

Carlos Lessa

I see that there are a lot of problems with my images above. So I restarted the process, but before,  I decided to do a test following this path

https://success.outsystems.com/Documentation/How-to_Guides/Data/How_to_update_a_Bootstrap_Action_to_fetch_an_entity_identifier_from_Excel

I created a module and entities like the explanation of the link above, but even so, I did not succeed and I can't understand why:





Best Regards, 

Jessica Marques. 




Can you upload the oml you had before?


Hello Carlos Lessa, 

Here is my Test.oml

Regards, 

Jessica. 

Jessica, in the link you sent above

Here they status is a string (Label) in your case you hade a number

here in this loop, you need to query to find a match between a Label and the string you have in the excel

and finally after return a record that match the label you are getting the identifier of this record to assign to the record you are creating

In your specific case, you don't have a string, you already have the id, so you don't need to do that match(unless you are trying to match to check if the record exist, cuz if don't will also fail to save), so saying that you can assign directly without the extra query (but just remember with the data isn't correct may fail  because you can be trying to save an FK that doesn't exist )

Hope this explanation can give you some insight into what is happening

Best regards

Carlos Lessa

Jessica Marques wrote:

Hello Carlos Lessa, 

Here is my Test.oml

Regards, 

Jessica. 

Here you are tring to assign the id of the expenseSatatus to the expenseId, and isnt that what you need, check the pic with the differences

To get that done  I added the missing attribute on the table

results:

The record with 0 on the pic is because you dont find a mach cus in the excel is rejected and in the static is reproved

Check the oml attached, the changes are there

Hope I could help you

Best regards

Carlos Lessa

Carlos Lessa wrote:

Jessica, in the link you sent above

Here they status is a string (Label) in your case you hade a number

here in this loop, you need to query to find a match between a Label and the string you have in the excel

and finally after return a record that match the label you are getting the identifier of this record to assign to the record you are creating

In your specific case, you don't have a string, you already have the id, so you don't need to do that match(unless you are trying to match to check if the record exist, cuz if don't will also fail to save), so saying that you can assign directly without the extra query (but just remember with the data isn't correct may fail  because you can be trying to save an FK that doesn't exist )

Hope this explanation can give you some insight into what is happening

Best regards

Carlos Lessa

Hello Carlos Lessa, 

Please ignore the other images about the excel work and the entity work
Now I just wanna understand this path

https://success.outsystems.com/Documentation/How-to_Guides/Data/How_to_update_a_Bootstrap_Action_to_fetch_an_entity_identifier_from_Excel


for this, I did equal and not how you say: 

"Here they status is a string (Label) in your case you hade a number"

Best Regards, 





I believe that I need to study more about bootstrap Excel, and now my information is very confusing to obtain some Help. for this, I will close this post and try after, with the concept better structured.


Thanks for all help,


Best Regards, 

Jessica Marques

Don't worry, take your time to study, you are in the right way.

I advise you to make one of the Paths from the online Bootcamp, it will save you hours of your coding when you understand the basics and there are some example of the bootstrap

Traditional web: https://www.outsystems.com/learn/courses/114/developing-web-apps-outsystems-11/?LearningPathId=2

Reactive: https://www.outsystems.com/learn/paths/18/becoming-a-reactive-web-developer/

Mobile: https://www.outsystems.com/learn/courses/115/developing-mobile-apps-outsystems-11/

Good code

Solution

Hello,


I got it to include the data of a static entity in the table, but for that, it was necessary after inserting the table with bootstrap and to create a server action and a button to delete the data from the table, after that, when I update the page I can see the label of the static entity normally. 


There is probably an easier way to do this if anyone knows, I take suggestions; )


I followed these two paths:


https://success.outsystems.com/Documentation/How-to_Guides/Data/How_to_update_a_Bootstrap_Action_to_fetch_an_entity_identifier_from_Excel


https://success.outsystems.com/Documentation/How-to_Guides/Data/How_to_delete_data_from_Entities


Attached I present the oml file with the test I did


thank you so much for your help!


Best Regards, 

Jessica Marques. 

Solution