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

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

Recommended Posts

Posted

You are incorrectly understanding the result of the filter operation.

The result is a list.

But your script step is looking for a true/false value.

 

Filter( "Black¶White¶Red¶Blue¶Green"; "Black") results in "Black"

 

You want to test for the value count of the result.

 

 

Set Variable [ $Colors; Value:"Black¶White¶Red¶Blue¶Green" ]

Set Variable [ $FilterColor; Value:"Black" ]
Set Variable [ $result; Value:FilterValues ( $Colors ; $FilterColor ) ]

If [ ValueCount( $result ) ]

Show Custom Dialog [ Title: "It filters"; Default Button: “Aceptar”, Commit: “Yes” ]

Else

Show Custom Dialog [ Title: "It doesn't filter"; Default Button: “Aceptar”, Commit: “Yes” ]

End If 

Posted

Also, if you did:

 

Set Variable $FilterColors ; Value:"Black¶Purple" ]

Set Variable [ $result; Filter( "Black¶White¶Red¶Blue¶Green"; $filterColors)]

 

The result would be "Black"

 

You would probably want to test for valueCount( $result ) = valueCount( $filtercolors )

Posted

I’m sorry but I think I didn’t explain myself well.

 

My goal:

 

I’m working on a Show Custom Dialog TAG.

 

I want to use the $AvailableColous variable as the TAG of a field. Once a colour is chosen, the next time I go through the dialog (I know a loop is needed), the TAG shouldn’t show the already chosen colour.

 

What I try to accomplish is to dynamically exclude the chosen colour from the available ones.

 

In another one of my posts, EOS, suggested me to use filtered portals instead of value lists. He drove my sample in that direction and in one of his sample scripts filters two variables to later exclude value in the filtered.

 

http://fmforums.com/forum/topic/89458-conditional-vl-including-2-join-tables/

 

script: SelectExecsInHolding,

section: #keep both lists synchronous

 

That is what I’m trying to do but I still can’t manage it. Too many to learn yet.

 

Thank you.

 

I’ve made some changes to the sample file.

Sample.zip

Posted

Well, perhaps you made some changes but they can't work because you ignored the logic problem of your IF statement.

 

Your statement

 

If [ FilterValues ( $AvailableColours ; $ChosenColour ) ]

 

Does not work as written.

 

It needs to be:

 

 

If [ ValueCount( FilterValues ( $AvailableColours ; $ChosenColour )) ]

SampleMOD.fmp12.zip

Posted

If [ ValueCount( FilterValues ( $AvailableColours ; $ChosenColour )) ]

 

This usually isn't a substantial difference, but the calculation will usually evaluate a little faster like so:

 

If [not IsEmpty ( FilterValues ( $shorterList ; $longerList ) )]

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