September 30, 200916 yr I am trying to gather the layout names in an IF statement. Below is what I am trying to do with multiple options, but can't get it right. Any help is appreciated. thanks! If [RightWords ( Get ( LayoutName ) ; 1 ) = "menu" or "detail" or "details" or "issues" or "edit" or "adminEdit" or "check" or "admin" or "list" or "MSLlist" or "status" ] ******************************* OK, I was able to make the following work. But is there a cleaner way to do this? If [ RightWords ( Get ( LayoutName ) ; 1 ) = "menu" or RightWords ( Get ( LayoutName ) ; 1 ) = "detail" or RightWords ( Get ( LayoutName ) ; 1 ) = "details" or RightWords ( Get ( LayoutName ) ; 1 ) = "issues" or RightWords ( Get ( LayoutName ) ; 1 ) = "edit" or RightWords ( Get ( LayoutName ) ; 1 ) = "adminEdit" or RightWords ( Get ( LayoutName ) ; 1 ) = "check" or RightWords ( Get ( LayoutName ) ; 1 ) = "admin" or RightWords ( Get ( LayoutName ) ; 1 ) = "list" or RightWords ( Get ( LayoutName ) ; 1 ) = "MSLlist" or "status" ] Edited September 30, 200916 yr by Guest new information
September 30, 200916 yr Try this If [ RightWords ( Get ( LayoutName ) ; 1 ) = "menu" or RightWords ( Get ( LayoutName ) ; 1 ) = "detail" or RightWords ( Get ( LayoutName ) ; 1 ) = "details" ] The above is a much shortened version of your requirement. Notice that each "quoted" item is compared individually. For ease of reading the individual tests are separated to different lines, which FM will permit you to do. Edited September 30, 200916 yr by Guest
September 30, 200916 yr How about using something like this? If [ not IsEmpty( FilterValues( "menu¶detail¶details¶issues¶edit¶adminEdit¶check¶admin¶list¶MSLlist¶status"; RightWords ( Get ( LayoutName ) ; 1 ) ) ) ] Edited September 30, 200916 yr by Guest
September 30, 200916 yr Even less is needed: If[ PatternCount( "¶menu¶detail¶details¶issues¶edit¶adminEdit¶check¶admin¶list¶MSLlist¶status¶"; "¶" & RightWords( Get( LayoutName ); 1 ) & "¶" )]
September 30, 200916 yr Author Thanks both. I understand the FilterValue version. I am confused on the PatternCount. Your returns "¶" are separating the words, and also is the pattern being looked for. The combination of the word & "¶", correct? Could this character be anything? Say the underscore "_" ? That is already in the layout names, ie, _form, _guest, etc. Then you are making that combination with the Get & "¶". What is the & "¶" at the end of the calc for ?
September 30, 200916 yr Author Thanks, I did get it to work as follows. I didn't understand the extra "¶" at the end and didn't use it. I also changed to the underscore "_". It all seems to be working. Thank you so much! PatternCount ( "_menu_detail_details_issues_edit_adminEdit_check_admin_list_MSLlist_status" ; "_" & RightWords ( Get ( LayoutName ) ; 1 ) ) or PatternCount ( "_form_guest_detail_guest" ; "_" & RightWords ( Get ( LayoutName ) ; 2 ) )
September 30, 200916 yr ...since you had "detail" both in singular and plural, would the patterncount arrive to two - my calc searches for the entire string including the pilcrow delimiter in both ends of each category, not that it matters in a if statement but more not to clutter the logic behind. --sd
September 30, 200916 yr Author That makes sense. Thanks for the explaination and great thought. I will add that in to both.
Create an account or sign in to comment