AnsweredAssumed Answered

If (field) contains "text" , then xxx

Question asked by BryanN on Mar 20, 2014
Latest reply on Mar 20, 2014 by BryanN


If (field) contains "text" , then xxx


     I searched for a bit but came up empty.  Browsing the functions references in the meantime but hopefully somebody has a quick answer.


     I'm making a script for navigation between layouts.  Each layout I have has both an 'editable' version where the fields are able to be entered and a 'non editable' version where they are grayed out.  As it stands right now, the default navigation is that as you click the link switch layouts, you always go to the 'non editable' version via a script.  So I don't have to change every link, I want to edit this script so that the destination layout name is calculated based on the following logic (for this example, I'll say we are currently in my "Vendors" (editable) layout and clicking on the "Customers" link to see customer records):


     If ( Get ( LayoutName ) contains the word "Edit" anywhere in the layout name) ; "Customers" & " " & "Edit" ; "Customers" )


     This would in effect send the user to the editable version of the layout if they are currently in an editable version of a layout.  If they are in the non-editable, it would send them to the non-editable.


     Make sense?



     Since the word "Edit" always appears at the end of the layout name, I ended up using RightWords function to pull the text for me, making my layout by calculation look like this:


     If (RightWords ( Get ( LayoutName ) ; 1 )  = "Edit"; "Customers Edit" ; "Customers" )


     Anyone see a flaw in that???