I am retrieving data from a database into LC fields
In one field there is not always a value, so that field remains empty. The database does that perfect.
How can I determine if this field has been filled with a string or has remained empty?
Coming from the Filemaker environment, where it is a simple statement like "If field is empty then....",
but this seems to be totally different in LC, and I can't find the solution.
Please help, should be simple
Thanks
Rob
How to determine if a field is filled or not
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, asayd
-
- Livecode Opensource Backer
- Posts: 79
- Joined: Sat Apr 17, 2010 9:21 am
Re: How to determine if a field is filled or not
In a button, say...
If you are putting stuff into flds from a database call, then there might be some invisibles inserted, cr's, spaces... so it might help you to make sure the fields are empty before you make the call to your database... with something as simplle as...
Code: Select all
on mouseUp
if fld 1 is empty then beep
end mouseUp
Code: Select all
repeat with count = 1 to the number of flds
put empty into fld count
end repeat
Re: How to determine if a field is filled or not
When I want to see if a field has no text, I sometimes use:
This ignores spaces, returns, and other invisibles. You could use that as a check to see if you need to put empty into the field, or just to ignore the field entirely.
Code: Select all
if the number of words in fld x = 0 then
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: How to determine if a field is filled or not
Jacque...
that's lovely... I would not have thought of that !
that's lovely... I would not have thought of that !
Re: How to determine if a field is filled or not
Thanks Dixie. I should probably warn that doesn't always work though, you need to know your data. Low-ascii characters like the ones that put small boxes into a field will count as a "word". But if you're pretty sure the data contains only typeable characters then it does well.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com