Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 6713 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Hi all,

I have been staring at this too long and can not quite figure out if it works or not yet. An outside view would be very handy.

Problem:

I want to combine multiple sets of a multiple number of elements such that each new set will always contain at least one element from each of the old sets, and each element from an old set will have at least one instance in a new set where it is the only element present from the old set.

Ok, how about a (semi)practical context:

I want to be able to return multiple multi-criteria sets in a portal at the same time. Say, all Female customers from New Haven and all Web customers from New York. However, I do not know the size of number of the sets beforehand. I know that a different field will be needed for each element of a set, so am already limited by the number of fields that I want to pre-create (In the above example, they would be linked to a Customer Multikey that has Gender, City, State, and Store Location as values).

I designed the attached repeating field method to work with up to 8 elements total, but should work for more as well. The problem is that I am not as comfortable on my combinatorial math as I would like to be - can anyone spot a scenario where it will fail?

Fields:

Set 1-8 (Text)

Filter 1-8 (Stored Calc):)

Let(

    [

        current = 1;

        firstend = Count( Set 1 );

        secondend = firstend + Count( Set 2 );

        thirdend = secondend + Count( Set 3 );

        fourthend = thirdend + Count( Set 4 );

        fifthend = fourthend + Count( Set 5 );

        sixthend = fifthend + Count( Set 6 );

        seventhend = sixthend + Count( Set 7 );

        eighthend = seventhend + Count( Set 3 );

        list = firstend & "¶" & secondend & "¶" & thirdend& "¶" &fourthend& "¶" &fifthend& "¶" &sixthend& "¶" &seventhend& "¶" &eighthend;

        rep = Get( CalculationRepetitionNumber )

    ];

    Case(

        rep = 1;

        Case(

            GetValue( list; rep ) >= current;

            Evaluate( "Set " & rep & "[" & current & "]" );

            Evaluate("Set "&rep&"["&Quote(Mod( current; Evaluate( "Count(Set " & rep & ")" ) ) + 1)&"]")

        );

        GetValue( list; rep ) > GetValue( list; rep - 1 );

        Case(

            GetValue( list; rep ) >= current and current > GetValue( list; rep - 1 );

            Evaluate( "Set " & rep & "[" & current - GetValue( list; rep - 1 ) & "]" );

            Evaluate("Set "&rep&"["&Quote(Mod( current; Evaluate( "Count(Set " & rep & ")" ) ) + 1)&"]")

        )

    )

)

'current' is the only thing that is changed with each filter:

Filter 1: current=1

Filter 2: current=2...

Thanks,

-Raz

Combine.fp7.zip

Posted

Nevermind-

I just realized that this could be done much easier via each set as a child filter record of a master filter view.

Also- typo above,

eighthend should read:

eighthend = seventhend + Count( Set 8 );

This topic is 6713 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.