51
Views
11
Comments
Solved
Insert Multiple Row Show Error
Question

Hai 




Give Some Solution 

Rank: #692
Solution

Hi Selva,

It seems the issue is with the "id" that you are passing in "CreatePurchaseOrderLine" action, while create records it should not be assigned explicitly as you are using create action. You have to modify your code a bit using any of the following ways:

1. Use create or update action instead of create action.

2. Create a local variable of type "PurchaseOrderLine" record and assign this variable as a source in "CreatePurchaseOrderLine" action.

3. If you have to assign id in "CreatePurchaseOrderLine" action use a check for max limit of id that you want to create records.

Hope this helps you.

Regards,

Vipasha

Rank: #137

Hi Selva,

What is the value you're passing to the primary key ("pk_PurchaseOrderLine")?

You can set it up to auto increment, and then there should never be a problem

with duplicating the value - the DB will take care of that. If you need to specify 

a value yourself, you'll need to write code to determine what the max value for that

field is, and then increment that.


Edit: Removed my rant that I made because of the also very minimalistic and demanding tone of OP. It was unprofessional of me. 

Rank: #692
Solution

Hi Selva,

It seems the issue is with the "id" that you are passing in "CreatePurchaseOrderLine" action, while create records it should not be assigned explicitly as you are using create action. You have to modify your code a bit using any of the following ways:

1. Use create or update action instead of create action.

2. Create a local variable of type "PurchaseOrderLine" record and assign this variable as a source in "CreatePurchaseOrderLine" action.

3. If you have to assign id in "CreatePurchaseOrderLine" action use a check for max limit of id that you want to create records.

Hope this helps you.

Regards,

Vipasha

As Vipasha said, the problem lies in the create action and specifically with the Id property.

If you change the highlighted section to NullIdentifier() your problem is fixed as the system will auto-generate the Id (assuming this is still the default behavior of the entities property). 

By the way, I think you have a major flaw in your datamodel. How do you keep a relationship with your orderline and your order? Currently I don't see any reference from the orderline to the order itself.

Greetings,

Vincent

Rank: #137

Hi,

could you share Entity Diagrams screenshot.

Rank: #139

Hi,


All of the above, but also :

I'm not seeing a reference attribute of type Purchase Order Id on the create, so I'm thinking the problem already started in the data modeling.

Dorine

Rank: #225

Agree with Dorine, the Entity 'PurchaseOrderLine' is designed to support one to one relationship, And you are getting an error because you are trying to insert multiple records against Single Purchase Order.

To support one to many relationship between entities, you should design PurchaseOrderLine entity as below.


Thanks,

Sachin


Rank: #692

Hi Selva, 

Would it be possible for you to either share OML or the error logs for you issue above.

Regards,

Vipasha

Rank: #1684

Hai Vipasha 

Its ready 

Thank You 



Regards

Selva

Rank: #1684

Thanks To All Outsystems Team 

I 'll Solve With Your All Comments Will Help Me 

Rank: #692

Hi Selva,

I am glad that your issue has been resolved.

Happy Coding.

Regards,

Vipasha