Jump to content

Quick portal filter question


Rich S

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

Recommended Posts

Howdy, all:

I have this filter for a self-join portal:

Let ( [

indexValues = List ( TEACHER::_kplt_TeacherID ) ;

searchValues = List ( TEACHER::Name_LF__lct ) ;

index = ValueCount ( Left ( indexValues ; Position ( ¶ &  indexValues  & ¶ ; ¶ & TEACHER_X::_kplt_TeacherID & ¶ ; 1 ; 1 ) ) ) ;

prevValues = LeftValues ( searchValues ; index -1 ) ] ;

IsEmpty ( FilterValues ( TEACHER_X::Name_LF__lct ; prevValues ) ) )

 

The filter works fine as-is but I also want to include in it another constraint where names will only appear if the Status__lxt field (for each name/record) is set to "ACTIVE".  I tried different permutations of adding that bit but I just can't get the portal to work as wanted. 

TIA for your help!

Link to comment
Share on other sites

I'd agree with Steve. you probably want

Let ( [

indexValues = List ( TEACHER::_kplt_TeacherID ) ;

searchValues = List ( TEACHER::Name_LF__lct ) ;

index = ValueCount ( Left ( indexValues ; Position ( ¶ &  indexValues  & ¶ ; ¶ & TEACHER_X::_kplt_TeacherID & ¶ ; 1 ; 1 ) ) ) ;

prevValues = LeftValues ( searchValues ; index -1 ) ] ;

IsEmpty ( FilterValues ( TEACHER_X::Name_LF__lct ; prevValues ) ) )

and

( Status__lxt = "ACTIVE" )

Does that work OK for you?

Edited by rwoods
Link to comment
Share on other sites

You have titled this as "quick portal filter question", but I don't see anything "quick" about it. The method you use (taken from here) relies on a list of all related values in order to remove the duplicates. If the relationship does not exclude non-active records, they too will be included in the list. You cannot use such list to filter only active records. The idea here is it pass a value only if it's the first time it appears in the list - but the first occurrence may have been a non-active record, so this becomes utterly unreliable.

The simplest solution, IMHO, is to modify the relationship so that it only includes active records. Otherwise you would have to find an alternative way to produce the list - e.g. by a recursive custom function. Or devise a completely different method. None of these will be "quick".

 

  • Like 1
Link to comment
Share on other sites

Thank you all! Steve and RWoods: I tried what you suggested but it didn't work, originally; however, when I changed the T.O. to the self-join table--instead of the "parent" table--it worked.

...but...

In a case of not seeing the forest through the trees, Comment's wisdom shines through and lights the way again: that making what appears to be a quick fix to solve the problem really doesn't solve the problem (or could make things worse when you expect data to appear where it should but it doesn't or it's wrong.) Thanks too, Comment, for inserting the hyperlink to the filter--my apologies to everyone for not including it in my original post.

Edited by WF7A
Link to comment
Share on other sites

This topic is 2495 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.