August 30, 201312 yr I am trying to filter two variables but I can't make it work. Could someone point me what am I doing wrong? Thank you. Sample.zip
August 30, 201312 yr 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
August 30, 201312 yr 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 )
August 31, 201312 yr Author 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
August 31, 201312 yr Instead of a loop you can use a recursive CF, like this very handy one: http://www.briandunning.com/cf/193 Some error trapping is also a good idea when dealing with those pesky users … Sample_Zap_eos.fmp12.zip
September 1, 201312 yr 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
September 1, 201312 yr 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 ) )]
Create an account or sign in to comment