innodes Posted September 30, 2009 Posted September 30, 2009 (edited) 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, 2009 by Guest new information
IdealData Posted September 30, 2009 Posted September 30, 2009 (edited) 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, 2009 by Guest
TheTominator Posted September 30, 2009 Posted September 30, 2009 (edited) 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, 2009 by Guest
Søren Dyhr Posted September 30, 2009 Posted September 30, 2009 Even less is needed: If[ PatternCount( "¶menu¶detail¶details¶issues¶edit¶adminEdit¶check¶admin¶list¶MSLlist¶status¶"; "¶" & RightWords( Get( LayoutName ); 1 ) & "¶" )]
innodes Posted September 30, 2009 Author Posted September 30, 2009 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 ?
innodes Posted September 30, 2009 Author Posted September 30, 2009 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 ) )
Søren Dyhr Posted September 30, 2009 Posted September 30, 2009 ...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
innodes Posted September 30, 2009 Author Posted September 30, 2009 That makes sense. Thanks for the explaination and great thought. I will add that in to both.
Recommended Posts
This topic is 5591 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 accountSign in
Already have an account? Sign in here.
Sign In Now