tchemiy Posted June 28, 2012 Share Posted June 28, 2012 Hi, Not really sure if I posted in the right forum directory, but anyways... The problem I've stumbled across is "How to tell Filemaker Pro not to insert carriage return if the current line is the last one?". That is to create labels. My calculation field goes like that: Case ( IsEmpty ( First ); " " & Last & "¶"; IsEmpty ( Last);" " & First & "¶"; " "&First & " " & Last & "¶" ) & "" & If ( IsEmpty ( Nickname ) ; "";" " & GetField ( "Nickname" ) & "¶" ) & "" & If ( IsEmpty (Title) ;"" ;" "& TextSize (GetField ("Title") ; 8 ) & "¶")& "" & If ( IsEmpty (Company ) ; "" ;" "& TextStyleAdd (GetField ("Company") ; Bold ) & "¶") & "" & If ( IsEmpty ( Division ) ; "" ; " "& GetField ("Division") & "¶") & "" & If ( IsEmpty ( ${Street 1 (Line 1)} ) ;"" ;" "& GetField ( "${Street 1 (Line 1)}" ) & "¶") & "" & If ( IsEmpty ( ${Street 1 (Line 2)} ); "" ; " "&GetField ( "${Street 1 (Line 2)}" ) & "¶") & "" & If ( IsEmpty ( City 1 ) ; "" ; " "&GetField ( "City 1" ) & "¶") & "" & Case ( IsEmpty ( State 1 & Zip 1 ) ;"" ; IsEmpty ( State 1 );" "& GetField ( "Zip 1" ) & "¶"; IsEmpty ( Zip 1 ); " "& GetField ( "State 1" ) & "¶"; " "&GetField ( "State 1" ) & ", " & GetField ( "Zip 1" ) & "¶" ) & "" & If ( Country 1 = "UK" ; "" ;" " & GetField ( "Country 1" ) ) Thanks Quote Link to comment Share on other sites More sharing options...
AHunter3 Posted June 28, 2012 Share Posted June 28, 2012 Yeah, that can be a tricky one. Here's how I generally do it: Field1 & Left ("¶"; Length (Field1)*Length(Field2)) & Field2 & Left ("¶"; Length (Field1&Field2)*Length(Field3)) & Field3 & Left ("¶"; Length (Field1&Field2&Field3) * Length (Field4)) & so on The hard returns get left out unless the fields on either side of them are non-empty. Thus where: Field1 = "tchemly" Field2 is blank Field3 is "FileMaker Cafe" Field4 is "filemakertoday.com" should return tchemly FileMaker Cafe filemakertoday.com Field1 = "tchemly" Field2 = "London UK" Field3 is blank Field4 is "Carriage Return Issues" should return tchemly London UK Carriage Return Issues Quote Link to comment Share on other sites More sharing options...
Marylouise Maltby Posted April 20, 2015 Share Posted April 20, 2015 I really need this. Thanks for the share. Quote Link to comment Share on other sites More sharing options...
eos Posted April 20, 2015 Share Posted April 20, 2015 I really need this. Actually, using List() and Substitute() , e.g. … List ( field1 ; field2 ; Substitute ( List ( field3 ; field4 ) ; ¶ ; " " ) ; Substitute ( List ( field5 ; field6 ) ; ¶ ; " and " ) ; field7 ; field8 ) … is IMO a better method; List() will simply ignore any empty results, and not generate a trailing CR. AHunter3 and I have been known to disagree on this in the past. Quote Link to comment Share on other sites More sharing options...
AHunter3 Posted April 20, 2015 Share Posted April 20, 2015 & still do But they both work. And it's good to learn multiple ways of doing things in FileMaker. At some future point, you may find one technique adapts to your new purpose better than the other. Quote Link to comment Share on other sites More sharing options...
Josh Ormond Posted April 20, 2015 Share Posted April 20, 2015 Alan - just curious. What are the pros of doing it your way? Have you seen a performance benefit from it? Or is it more of a muscle-memory thing? This is one of the calculation approaches I've never tested myself, to see how both perform. Quote Link to comment Share on other sites More sharing options...
AHunter3 Posted April 21, 2015 Share Posted April 21, 2015 To me it's more self-explanatory, although that could be the illustion of familiarity pretending to transparency. It's also (in my opinion) more flexible, in the sense that if your delimiters are not hard returns you can still use it natively without first substituting returns for the delimiters in use. In the often-recurring case of elements of postal addresses that may or may not exist for a given address, people often also want different "connectors" — commas here, the word " and " inserted between the next two, honorific before the name only if there's a proper name and not just a company, etc — and the "Length" technique using the multiplier that equates to zero in situations where you don't want it works for those additional bits & pieces as well. 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.