debbiespray Posted March 7, 2013 Share Posted March 7, 2013 This seems SO simple, yet it doesn't work... if (Len(Trim(Field("FIRST NAME")) >= 2)) { return Field(Trim("FIRST NAME")); } else { return ("Hello"); } ...basically just wanting to have "Hello" if a First Name has less than 2 characters. The First Name as in the data is the result without regards to the length of characters. I've used this logic in other programs, but can't seem to get the same result in FP. Any help would be appreciated - Thanks! Quote Link to comment Share on other sites More sharing options...
step Posted March 7, 2013 Share Posted March 7, 2013 (edited) Your syntax is a little mixed up: if (Len(Trim(Field("FIRST NAME"))[color="red"])[/color] >= 2) // You were missing a ')' and had an extra one at the trail end { return [color="red"]Trim[/color]([color="Red"]Field[/color]("FIRST NAME")); // Trim function needs to be around the Field } else { return "Hello"; // You do not need '()' around this string } Of course, if you'd like to condense your code a little, you could replace it with this: return (Len(Trim(Field("FIRST NAME"))) >= 2 ) ? Trim(Field("FIRST NAME")) : "Hello"; Edited March 7, 2013 by step Quote Link to comment Share on other sites More sharing options...
debbiespray Posted March 7, 2013 Author Share Posted March 7, 2013 Thanks! I especially appreciate the condensed code. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.