Monday, January 30, 2012
A simple shortcut for moving your layout parts
Monday, January 16, 2012
Carriage returns and the case of the disappearing data
Over many years of developing FileMaker solutions I've been flummoxed on more than one occasion by the invisible foe that is – the carriage return.
My broad recommendation?
Don’t allow entry of carriage returns into a field unless :
- You have a lot of spare time on your hands and enjoy troubleshooting client problems.
- The fields in question specifically require carriage returns, e.g. large blocks of text which require paragraphs to be included within the text.
- You (the developer) are controlling the insertion and removal of carriage returns because you need them for establishing relationships or other developer controlled trickery.
For those of you who haven’t already come across this issue I’ll explain why it happens and what the consequences are.
Mr Average User is entering data into the database and hits the Return key after typing in the required value. Pretty standard stuff for an Excel power user and he expects things to work the same in FileMaker. When the cursor doesn’t switch to the next field in the tab order he uses his mouse, clicking into the next field on the layout. No harm no foul as far as he’s concerned.
What the user doesn’t realise is that they’ve entered the value they intended plus an extra character, the carriage return.
The day continues on and then later that day, the next day, next week or a month later some peculiar behaviour is reported.
A particular customer’s last name isn’t being shown on printed invoices. The user verifies the data shown on the screen is correct and everything seems ok. The problems arises when a concatenated field is using one or more fields that contain carriage return. A simple calculation like Firstname & "" & Lastname produces unexpected results.
Instead of returning John Smith we end up with
John
Smith
The field on our print layout only includes provision for one line so the lastname is not shown at all, even though the user sees the value recorded in the Lastname field for the relevant contact. Let the confusion begin!
This scenario can also cause problems when you’re passing script parameters separated by carriage returns as you’ve got more values than you were expecting.
How can we avoid this problem?
- Configure your fields so that Field Behavior includes Go to next Object using Return.
- Check any data you’re importing from other data sources doesn't include superfluous carriage returns.
- Don’t assume that just because you can’t see a problem, there isn't one.