Too many errors in grid with Unique field trigger?

Posted by matman on 10-Dec-2014 07:44

I'm trying to force an unique field combination in a grid using a unique field trigger. It seems to be working OK, but throwing too many errors. My picture below will explain further:

In the picture below, every Supplier is the same. Every row contains a different Article, except for Row #1 and #4, they contain the same article. The unique field trigger does seem to do it's job, unfortunately the error is thrown 4 times, rather than once.

I have not entered a trigger condition, I only selected a field combination. I hope that's not the problem?

EDIT: I just noticed the unique field trigger triggers even when there are not more than 1 unique field combination.

All Replies

Posted by Gian Torralba on 10-Dec-2014 08:45

Hello,

The unique field combination will also check existing records to see if there is a matching combination already. If it does see an existing combination, it will throw the error per row. See Chapter 5: Adding Business Logic > Workflows and Triggers in the Rollbase User Guide.

Thank you,
Gian

Posted by matman on 10-Dec-2014 08:56

Hi Gian, thanks for your reply. For test purposes I now deleted all other records, so no unique combination exists. Also, I changed the Unique Field Combination to "Price list" and "Article" (Converted relationship). But now, when I edit and update no error is thrown, even though two rows are the same.

Posted by Gian Torralba on 10-Dec-2014 09:02

Hello,

The records should have the same Price List - Article. not Supplier - Article since you changed the combination for the trigger.

Hope this helps.

Thank you,

Gian

Posted by matman on 10-Dec-2014 10:38

The trigger seems to be working correctly on "Article Price" Edit page, but not on "Price List" Edit page with grid control.

Posted by Gian Torralba on 10-Dec-2014 10:47

Hello,

If this is from two different objects, I suggest that you create a unique fields combination trigger on both objects since it will only run on a specific object in which you added the trigger.

Thank you,
Gian

Posted by matman on 11-Dec-2014 02:26

Hi Gian, unfortunately it is a complex relationship with an intermediate Object. I can't add the trigger to more than 1 object. I have a "Price List" and "Article", these two are combined via a "Article Price" object. Only on this Artical Price object I can create the trigger, because it's the only one that has a link with Price List and Article.

Posted by Gian Torralba on 11-Dec-2014 09:02

Hello,

You need to add the trigger on the grid's object itself. In this case, all saved records in the grid object will check if there is an existing combination for that object.

Thank you,
Gian

Posted by matman on 11-Dec-2014 09:11

Hi Gian, I have done this. It just doesn't seem to work.

Posted by Gian Torralba on 11-Dec-2014 09:13

Hello,

Let me test this one and get back to you. What do you mean it is not working? Does it not throw the errors anymore?

Thank you,
Gian

Posted by matman on 11-Dec-2014 09:19

It is working, it just doesn't throw errors for this combination for some reason. When I only select "Article",  errors are thrown. When I select "Article" and "Supplier" errors are thrown. But when I select "Article" and "Price list", no errors are thrown, even though duplicates exist.


I am viewing the grid from New Price List page. Current object structure:

Article 1 > M Article Price M > 1 Price List

"Article Price" was created by converting a M > M relationship between Article and Price List.

Posted by Gian Torralba on 11-Dec-2014 10:29

Hello,

Can you post your updated screenshot with the price list field in the grid?


Thank you,

Gian

Posted by matman on 11-Dec-2014 10:33

Hi Gian, I cannot add the Price List field to the grid because the page I'm viewing the grid from is owned by the Price List object.

Posted by Gian Torralba on 11-Dec-2014 10:41

Hmm.. But you are saying that you are trying different combinations in the field unique field combination trigger and you said that you are paring price list - articles. Price list should be in the price per article grid in order for the combination to exist.

Posted by matman on 15-Dec-2014 03:02

Yes, I'm trying different combinations, because it didn't work with the combination I was using. I cannot select the price list in the price per article grid because I'm viewing the grid from the New price list page. I cannot select a price list when I'm creating a price list.

Posted by Gian Torralba on 09-Jan-2015 10:18

Hello,

Are you able to make the combinations work?

Thank you,
Gian

Posted by matman on 09-Jan-2015 10:28

Unfortunately no, but I would appreciate it if you could take another look:

Posted by Gian Torralba on 09-Jan-2015 14:04

Hello,

May I know the combination of the Article Price object? If this object has the unique fields combination trigger, it should fire an error if there is an existing combination in the Article Price object.

Thank you,
Gian

Posted by matman on 12-Jan-2015 02:37

Hi Gian, the third image is the Article Price unique field combination trigger.

Posted by matman on 12-Jan-2015 02:42

I forgot to add that the unique field combination trigger works on the New Article Price and Quick Create Article Price pages. But it doesn't work in the grid on the Edit Article page. Example below:

New Article Price page

Edit Article page Grid

Posted by Gian Torralba on 12-Jan-2015 08:36

Hello,

The Price List field is not included in the Grid. It should be since the combination will check those 3 fields.

Thank you,

Gian

Posted by matman on 12-Jan-2015 08:39

Hi Gian, this is not possible. I am accessing the grid from the Edit Price List page, so I cannot include it:

Posted by Gian Torralba on 21-Jan-2015 08:16

Hello,

But the three fields are showing correctly in the edit page you just showed previously. It should be possible to display all those fields in the grid as well. The fields that needs to be checked must be included in the form for it to be able to check for existing combinations.

Thank you,
Gian

This thread is closed