Jump to content
shredded

Filtered Occurrence

Recommended Posts

I have a relationship calc for a portal that will show either all products, or all products pertaining to another drop down of the season I am viewing.

Case ( not IsEmpty ( Settings::gCheckBox ) ; Project::cProductID_ListSeason //occurrence filtered by season selector ; Project::cProductID_ListLocal //all products occurrence )

This all works fine, but I'd like to update the Project::cProductID_ListSeason to also show products that have 0 seasons assigned to them.

My entities are:

Projects <- Products <-> AssignedSeasons <- Seasons

What would be a good approach to gather ProductIDs that contain no SeasonIDs and combine them into the list of products that do have SeasonIDs?

I want to add new products with no season while I'm filtered, then apply the season to them, without have to show all...assign, then filter by season again. Hope that makes sense :angel:

Edited by shredded

Share this post


Link to post
Share on other sites

Hi Shredded,

 

One option would be to add another field as a check or radio button to the layout to determine whether you want to see the 0 seasons or not and refine you calculation field based on this newly added field.

 

I hope this would help.

 

Regards,

Share this post


Link to post
Share on other sites

This is what I did that seems to work fine. The only thing is that Im listing a lot of values, even though the relationship filters the correct ProductIDs. Would there be a performance increase if the calculation also determined the relationship, rather than through a table connection? If so, how can I also include Products::_fkParentID to Parent::__ParentID

Let(
    [
        KeyA = SettingsGlobal::gSelect_Season;
        KeyB = GetValue( Products::gSeasonSelectKey; 3 );
        KeyC = GetValue( Products::gSeasonSelectKey; 4 )
    ];
    If(
        not IsEmpty( SettingsGlobal::gSelect_ShowCurrentChoice );
        Case(
            not PatternCount( SettingsGlobal::gSelect_Season; "Collection" );
            ExecuteSQL(
                "SELECT \"__ProductID\" FROM Products WHERE cSeasonStart = ? OR cSeasonStart IS NULL";
                "";
                "";
                KeyA
            );
            PatternCount( SettingsGlobal::gSelect_Season; "Collection" );
            ExecuteSQL(
                "SELECT \"__ProductID\" FROM Products WHERE cSeasonStart = ? OR cSeasonStart = ? OR cSeasonStart IS NULL";
                "";
                "";
                KeyC;
                KeyB
            );
        );
        ExecuteSQL( "SELECT \"__ProductID\" FROM Products "; ""; "" )
    )
)

 

Edited by Lee Smith
formatted the calc

Share this post


Link to post
Share on other sites

As of my knowledge, working through relationship has less negative impact on the performance than calculation fields.

Share this post


Link to post
Share on other sites

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

  • Who Viewed the Topic

    1 member has viewed this topic:
    scrumpto 
×

Important Information

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