I used KB 2403 to copy data to one field from multiple portal records, and after some tweaking, it worked. But now I have a carriage return on a blank line after the last entry. Is there a way to delete that carriage return?
Ok, I'll bite. What does KB 2403 mean?
There are a number of ways to eliminate carriage return characters, but would like to know more before I open mouth and insert foot.
Sorry. KB refers to Knowledge Base. If you go to the knowledge base under Support on the www.filemaker.com site and type that number, you will get the article titled How To Copy Data To One Field From Multiple Portal Records.
Got it. So you have a long text field with multiple values separated by carriage returns and the last line in your field is blank except for a carriage return right?
With a script you can do it umpteen different ways. Here's one using set field:
Set Field [table::Textfield, If(right(table::TextField,1) = "<Paragraph Mark>"; left(table::TextField; length(Table::TextField) -1); Table::TextField)]
TextField is the name of your textfield with the extra return character. <Paragraph Mark> is where you click a button in the expression editor to insert a paragraph mark. (looks a bit like the capital letter "P".)
How it works:
The if function checks the last letter in the field (Right(table::TextField,1)) to see if it is a carriage return. If it is, that character is deleted.
If you need to do this on multiple records, you can use set field in a loop to step through the records, or you can but the If() function in a "Replace Field Contents" step.
BTW you might have gotten a quicker response if you'd posted it to the Using Filemaker forum instead of Using Filemaker Server.
Very nice - simple and elegant. I had 5 fields and 800 records with the extra carriage returns, and your solution removed them in about 25 seconds. So is there a way to move this thread to the "Using Filemaker" forum? I thought I had originally posted it to that forum.