Comparing Collections

Posted by Anverion on 01-Feb-2019 08:28

Hello--

I have been trying for several hours to figure this out, however, I thought I run this by the group to see if they have some suggestions. I have two collections:

1. Earnings Details

2. Reference

What I need to do is to compare 4 key fields in the Earnings Details collection with the reference table to ensure that I have a valid combination.

In the Earnings Details, I have the following four fields:

1. Fund Type

2. Payment Type

3. Performer Type

4. Contract Type

The values of these fields must match a single element in the collection or it's an invalid combination.

I have tried using the exists operator, but I see a ton of duplicate results. Since I have 9 elements int the Details, I would expect the same number, pass or fail.

What I have tried:

cmsefd->exists(cmsefd.fundType=ref.fundtype,cmsefd.paymentType=ref.paymentType,cmsefd.performerType=ref.performerType,cmsefd.contractType=ref.contractType.)

I will try and post images when I get a chance. VPN from home isn't allowing me to copy at the moment.

Thanks for help!

- Branden

Posted by Gertjan Hendriks on 04-Feb-2019 09:42

Hi Branden,

As meijsberg already stated this is a possible Cartesian Product.

I created a collection of database record instances and a collection of references. The Vocabulary could then look like this:

Next you will set up your RuleSheet like this, where you use Filters, in order to only process the data that you actually need. Preconditions are in general faster than regular filters, especially with larger amounts of data, so I'd suggest you use those:

This would then lead to this RuleTest (and results):

I hope this answers your question.

-Gertjan

All Replies

Posted by meijsberg on 01-Feb-2019 09:17

I'm not a very experienced Corticon user, so I don’t have a direct answer to your problem. Nor do I understand the exact mechanics of your rule statement. Maybe it is some kind of a cartesian product this statement is producing.

But when facing a "complex" problem like this, I like to make the problem smaller.

Can you for instance validate the four details separately for instance? Since you are using one entity for four different meanings, you might need to uses aliases in the advanced view (not sure about that).

Posted by Gertjan Hendriks on 01-Feb-2019 09:33

Hi Branden,

I'm having a hard time understanding your question, but I hope the attached examples answer your question?

-Gertjan

Posted by Anverion on 01-Feb-2019 16:35

Let me explain my situation a little better. I'm using ADC to pull details from Oracle. In those details, I have 4 fields I need to validate to ensure that they represent a valid combination. I pull in reference data that has 4 fields, 127 rows. I need to iterate though that reference data and compare the 4 fields in the details.

Example.

Details:

Session, Principal, Theatrical, AFTRA

Residual, null, Television, SAG

Reference Data:

Session, Background, Theatrical, AFTRA

Residual, Session, Theatrical, AFTRA

Session, Principal, Television, SAG

Session, Principal, Theatrical, AFTRA

In this example, Detail 1 matches reference 4 so I have a valid combination for Detail 1.

Detail 2, after iterating through all reference data has no valid combination.

Sounds easy, I know, however, the results are duplicated for each detail.

Hope that helps a bit.

- Branden

Posted by Gertjan Hendriks on 04-Feb-2019 09:42

Hi Branden,

As meijsberg already stated this is a possible Cartesian Product.

I created a collection of database record instances and a collection of references. The Vocabulary could then look like this:

Next you will set up your RuleSheet like this, where you use Filters, in order to only process the data that you actually need. Preconditions are in general faster than regular filters, especially with larger amounts of data, so I'd suggest you use those:

This would then lead to this RuleTest (and results):

I hope this answers your question.

-Gertjan

This thread is closed