Clearing a lot of fields
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
- 
				Glenn Boyce
- Posts: 137
- Joined: Thu Jul 24, 2008 11:22 pm
Clearing a lot of fields
Someone once gave me some code for clearing a whole lot of fields on a card with out writing "put "" into fld "fieldname"" for each one. I have a very busy card and need a clear button on it and think that now is the time to use that piece of code!! Any help appreciated.
Cheers
Glenn
			
			
									
									
						Cheers
Glenn
Clearing a lot of fields
Glenn,
Try this:
Ed
http://idleaders.com
			
			
									
									
						Try this:
Code: Select all
on mouseUp
   put the number of fields on this card into lastField
   repeat with x = 1 to lastField
      put empty into fld x
   end repeat
end mouseUp
http://idleaders.com
- 
				Glenn Boyce
- Posts: 137
- Joined: Thu Jul 24, 2008 11:22 pm
Clearing fields
Great that cleared them all right. BUT it also cleared all the label fields as well!! I just want to clear the ones I have entered data into.
cheers
			
			
									
									
						cheers
Clearing a lot of fields
Glenn,
If you have a naming convention that differentiates your label fields from data entry fields, this is easy. For example, you can name all your labels with the preface "label" (i.e. labelName, labelStreet, labelCity). Then you could ignore those fields in the below code:
HTH,
Ed
			
			
									
									If you have a naming convention that differentiates your label fields from data entry fields, this is easy. For example, you can name all your labels with the preface "label" (i.e. labelName, labelStreet, labelCity). Then you could ignore those fields in the below code:
Code: Select all
on mouseUp
   put the number of fields on this card into lastField
   repeat with x = 1 to lastField
      put the short name of fld x into tFld
      if tFld contains "label" then
         // do nothing
      else
         put empty into fld x
      end if
   end repeat
end mouseUp
Ed
--
Ed Lavieri
three19
www.three19.com
--
						Ed Lavieri
three19
www.three19.com
--
Hi Glenn,
"label" fields have their "locktext" property set to true, so you better check for this prop than for the name, which may NOT contain "label" Best
Best
Klaus
			
			
									
									
						"label" fields have their "locktext" property set to true, so you better check for this prop than for the name, which may NOT contain "label"
 
Code: Select all
on mouseUp 
   put the number of fields on this card into lastField 
   repeat with x = 1 to lastField 
      if the locktext of fld x <> true then 
          put empty into fld x 
      end if 
   end repeat 
end mouseUp Klaus
