Trying to import an excel file in import button with a pop up (excel to record list)

Hello! I'm trying to import an excel file with excel to record list (as same columns with the image) in import button  with a pop up (upload widget) and keeps on getting this error. Attached is my oml for clearer visualization. Thanks!

SlimDirectory.oml

Hi @John Renz Errol del Mundo,

Your import action in "SlimDirectory_Core" module. Attach OAP to analyze further.

It seems you are uploading duplicate records to the table.. validate once.

Thanks, Aadhavan S

I attached here the slim directory oml to analyze further. Thanks!

SlimDirectoryCore.oml

Hi,

You should be carefull about reference ids. Could you share excel with sample data? 


Sincerely,

Necmettin

Hello Necmettin! I attached now the sample data.

EmployeesampleforImport.xlsx

Hello @John Renz Errol del Mundo 

The RoleId was being inserted as a 0 into the Employee table so that was the root cause for the Foreign Key error you were encountering. 

Since the birthdate is mandatory, I fixed the sample excel you shared and then made the following changes to the Core module:

1. Changed the Record definition of the Import Excel from 'Employee' to the 'Excel_Employee' structure you already had created but were not using. 


2. Created an EmployeeRec local variable in 'ImportAction'.

3. Added the GetRolesByRoleName aggregate to get the RoleId for the imported RoleName.

4. Passed the EmployeeRec to the 'Creat_Employee' action.

The file was uploaded successfully.

Based on the above, you should be able to similarly figure out how to insert a supervisor, and also insert into Employee2Expertise entity.

I have attached the core oml with the above changes.

Regards,

AJ



SlimDirectoryCorev2.oml

Hi,

You may try to insert RoleId as null in Employee table.

Debug your ImportAction in SlimDirectory_Core module. You will see the exact reason for it.


Best regards,

Necmettin

Thanks everyone for answering! I just figured out what to do and now the import button is properly functioning, one thing I'm still figuring out is how to import supervisor with validation (only role of supervisor with be valid for import) and also with the expertise, its kind a difficult for me how to import those values which is more than one. Anyways, thank you so much again guys!

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