Too many errors in grid with Unique field trigger? - Forum - Rollbase - Progress Community

Too many errors in grid with Unique field trigger?

 Forum

Too many errors in grid with Unique field trigger?

This question is not answered

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
  • 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
  • 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.

  • 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

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

  • 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
  • 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.

  • 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
  • Hi Gian, I have done this. It just doesn't seem to work.

  • 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
  • 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.

  • Hello,

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


    Thank you,

    Gian

  • 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.

  • 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.

  • 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.

  • Hello,

    Are you able to make the combinations work?

    Thank you,
    Gian