Import Excel for two Entities with relatioship

Hi Experts,


How can i implement on Importing/upload an excel on a two entities with relationship identifier.


Thanks and Best Regards.

joshua aquino wrote:

Hi Experts,


How can i implement on Importing/upload an excel on a two entities with relationship identifier.


Thanks and Best Regards.

Hi there Joshua.

You can use the "ExcelToRecordList" and after use "for each" for create record by record.

But before, you need create a struct with your columns equal of excel.

Regards.

Carlos Alfradique


Hi Joshua,

How is the relationship defined in the Excel file? Is it through an Identifier? Is this Identifier an auto number in the target data model?


Kilian Hekhuis wrote:

Hi Joshua,

How is the relationship defined in the Excel file? Is it through an Identifier? Is this Identifier an auto number in the target data model?


Thanks for you reply

Hi Carlos,

Yes i am using the widget to upload into my entity. However what I'm trying to accomplish is to upload it that the entities that have a relationship. 


Hi Kilian,

It is through identifier and auto number.


I have attached my sample OML.




joshua aquino wrote:

Kilian Hekhuis wrote:

Hi Joshua,

How is the relationship defined in the Excel file? Is it through an Identifier? Is this Identifier an auto number in the target data model?


Thanks for you reply

Hi Carlos,

Yes i am using the widget to upload into my entity. However what I'm trying to accomplish is to upload it that the entities that have a relationship. 


Hi Kilian,

It is through identifier and auto number.


I have attached my sample OML.




Hi Joshua.

You need include one assign after the createOrUpdate User List.


Because you need the id of OutSystems.


Regards.

In addition to the solution to your problem that Carlos already gave, some observations about the code:

  1. "UserList" is a strange name for an Entity. There's no "List" involved here. You should pick names that make sense.
  2. The Assign isn't named (always a bad thing), but inside it, you are assigning all the fields individually. Personally I'd just assign the records and set Id to NullIdentifier() for easier reading.
  3. You're using a "create or update", but you are always creating records (since the Id is NullIdentifier()). In that case, it's faster to use a "create".


Hi @Kilian thanks for your observation and suggestions.

Hi @Carlos thanks for your suggestion.

I have already use your suggestion prior however it is not working for me.


I have attached my OML.

Solution

Hi Joshua,

Changed your code a bit. Look the attached OML.

Regards,

Marcelo

Solution

Marcelo Ferreira wrote:

Hi Joshua,

Changed your code a bit. Look the attached OML.

Regards,

Marcelo


Hi Marcelo,


Thank you for your reply. 

i gained new knowledge. ^_^


Thanks and Best Regards