ChangeAgent Posted September 25, 2007 Posted September 25, 2007 I have a database (FMP 6) where I pull a number of fields together to get a layout for an envelope. I do this through a defined calculation field. The programming is: Title & "¶" & First Name & " " & Last Name & "¶" & Company & "¶" & Street 1 & "¶" & "¶" & Postal Code 1 & " " & City 1 & "¶" & Country 1 Now if there is no company I have a gap between the texts. Is there a way of avoiding this? Like having the text move up one line? Thanks
bcooney Posted September 25, 2007 Posted September 25, 2007 Title & "¶" & First Name & " " & Last Name & "¶" & if ( not isempty (Company), Company & "¶") & Street 1 & "¶" & "¶" & Postal Code 1 & " " & City 1 & "¶" & Country 1
ChangeAgent Posted September 26, 2007 Author Posted September 26, 2007 Barbara I did that and it does not work. here is what I did: Title & "¶" & First Name & " " & Last Name & "¶" & if ( not isempty (Company), Company & "¶" & Street 1 & "¶" & "¶" & Postal Code 1 & " " & City 1 & "¶" & Country 1 message I get is: 'There are too few separators in this function' could this have to do with FMP 6?
Vaughan Posted September 27, 2007 Posted September 27, 2007 "could this have to do with FMP 6?" No it's because there are too few separators in the function. It's missing the closing ")" before " & Street 1 ....". Copy and paste Barbara's function from the web page. What she has posted is correct.
Raybaudi Posted September 27, 2007 Posted September 27, 2007 Hi you forgot a ")" !! Title & "¶" & First Name & " " & Last Name & "¶" & if ( not isempty (Company), Company & "¶" [color:red]) & Street 1 & "¶" & "¶" & Postal Code 1 & " " & City 1 & "¶" & Country 1
ChangeAgent Posted September 27, 2007 Author Posted September 27, 2007 OK, raybaudi and Vaughan I have tried both your suggestions and neuutehr one works! I still get the message: 'There are too few separators in this function' So I solved it as follows with a new formula: Case( not IsEmpty( Title ) , Title ) & " " & Case( not IsEmpty( First Name ) , First Name ) & " " & Case( not IsEmpty( Last Name ) , Last Name & "¶" ) & Case( not IsEmpty( Company ) , Company & "¶" ) & Case( not IsEmpty( Street 1 ) , Street 1 & "¶" ) & Case( not IsEmpty( Postal Code 1 ) , Postal Code 1 & "¶" ) & Case( not IsEmpty( City 1 ) , City 1 & "¶" ) & Case( not IsEmpty( State Province 1 ) , State Province 1 & "¶" ) & Case( not IsEmpty( Country 1 ) , Country 1 & "¶" ) Thanks for your help!
Vaughan Posted September 27, 2007 Posted September 27, 2007 Sorry to say, but "Case( not IsEmpty( Title ) , Title )" is redundant because you are saying "if the field is not empty display it otherwise do not display it". It's redundant because if it's empty there is nothing to display. Instead of changing the calculation, try to work out what the problem is. You'll learn more.
ChangeAgent Posted September 28, 2007 Author Posted September 28, 2007 Thanks for that tip Vaughan, good thinking and I see what you mean. as I was unable to find what was wrong in my original code I be interested if you can spot it. I am all for learning! so why does Title & "¶" & First Name & " " & Last Name & "¶" & if ( not isempty (Company), Company & "¶") & Street 1 & "¶" & "¶" & Postal Code 1 & " " & City 1 & "¶" & Country 1 not work? I get: 'There are too few separators in this function' while people here say it is correct. i am puzzled...
comment Posted September 28, 2007 Posted September 28, 2007 In version 6 and below, the syntax for the If() function is: If (test, result one, result two) The 'result two' parameter is NOT optional (as it is in later versions). Therefore you must add an empty result, or - preferably - use the Case() function instead: Title & "¶" & First Name & " " & Last Name & "¶" & Case( not IsEmpty(Company), Company & "¶") & Street 1 & "¶¶" & Postal Code 1 & " " & City 1 & "¶" & Country 1
ChangeAgent Posted September 28, 2007 Author Posted September 28, 2007 no worries, I know it is ancient -)) just do not have the money to get a higher version.
Recommended Posts
This topic is 6266 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