Preventing a user from entering overlapping data

0
Greetings, I need assistance with preventing a user from entering overlapping data. I have 2 attributes; Minimum FICO score and Maximum FICO Score. A user needs to enter both the min and max FICO score along with associated rate information. I need to prevent a user from entering an overlapping FICO score. Entry 1: 341-441 Entry 2: 442-542 Entry 3: 520-620  (should not be allowed as this is overlapping data) Any suugestions on how to handle this, would be greatly appreciated! Regards, Beth
asked
2 answers
6

Hi Beth,

Actually this is a mathematical problem. You can check math forums for an answer. I have shared a microflow that checks a range against an existing range. You can find it here

Regards,

Jeroen

answered
0

Beth,

You could accomplish this with a microflow that determines the max FICO score of the previous record and sets the min FICO score for a new record to the previous min + 1.  If your domain model looks like:

  • Product entity, having a 1 to many association with
  • Rate entity (this is the entity with the min and max FICO scores)

When you create a new Rate object for a given product, you would call a microflow that would:

  • Retrieve all existing Rate objects for the passed in Product (in this retrieve, sort by max FICO descending)
  • Use a List Action with the Head operator, which will give you the existing record with the largest max FICO
  • Create a new Rate object with the min FICO value set to largest max FICO + 1

On the page where the Rate objects are edited, you could make the min FICO score field uneditable, if this fits with your business rules.  In this way, the min FICO score is always set to the next sequential number based on existing objects.

The only other thing to take care of is the case where there are no existing Rate records for a Product.  In this case, you could set min FICO to a fixed number like that fits with your business rules, or offer the user the opportunity to edit that number.

Hope that helps,

Mike

answered