Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

field number - change to format f00n

Featured Replies

  • Newbies

Does anyone know how to change the field number from the format fn (f1, f2,...,f10, f11,...) to f00n (f001,...f099...)?

Help is appreciated.

-MJ

Are you trying to change the field names? For that you'd need some kind of macro utility like Applescript (Mac) or Auto-It (Windows). How many fields are you trying to change?

Try this with a calculated text field:

New_Field="f" & Right("000" & Substitute(Old_Field, "f", ""), 3)

This will work for values which have "f" and 3 digits or fewer. If you expect to have more digits following the "f", then increase the number of 0's in the calculation and the number at the far right of the calculation appropriately.

  • Author
  • Newbies

The problem is that the fields are in an already-in-use database. Is there any hope?

There is always hope -- but read this entire reply before proceeding.

If you want to replace the values across your entire database, do this:

1. BACK UP YOUR DATABASE

2. Show All Records

3. Select the field you want to replace the values in

4. Select Replace... from the Records menu

5. Choose Replace with Calculated Result

6. Enter the calculation I gave you above. Be sure to change the field name to the name of the field you are replacing.

7. Click Replace

***WARNING***

THIS CANNOT BE UNDONE -- BE SURE TO MAKE A BACKUP FIRST!

I really recommend trying this with a calculated text field first, as I described earlier, just so you can be sure what sort of a result you will end up with after the replace. I cannot emphasize this enough. If the values you are replacing are keys in a relationship, the relationship will be broken. If the values you are replacing are used in other calculated fields, the calculations may also break.

  • Author
  • Newbies

quote:

Originally posted by Thom:

Are you trying to change the field names? For that you'd need some kind of macro utility like Applescript (Mac) or Auto-It (Windows). How many fields are you trying to change?

Yes, I'm trying to change the field names of 99 records (I'm assuming that I don't need to change fields over 99, as they already have a three-digit number). Is this freeware or shareware (I'm working on a Windows-2000 platform)?

-MJ

quote:

Originally posted by MJC:

Yes, I'm trying to change the field names of 99 records...

My apologies for what may have been a very misleading answer... didn't think carefully enough about what you wanted to achieve. smile.gif" border="0

  • Author
  • Newbies

Thom-

I'd greatly appreciate help w/the script.

Thanks,

MJ

AutoIt is freeware: http://www.hiddensoft.com/AutoIt/

You write a script in its own language, and it sends keystrokes and mouse-clicks to the computer. Keystrokes tend to be more reliable. I'd be happy to help you with the script, if you need it.

Assuming you have AutoIt installed, the .aut extension should be registered. Save the following code with a filename ending in .aut, like fm-rename-fields.aut . Have your FileMaker file open and in front. Switch to the folder with the .aut file, and double-click to run it. It will switch to FileMaker, open Define Fields, and begin renaming the fields from f1->f001, etc., up through f99->f099. As always, make a backup first.

code:


; FileMaker rename fields (fm-rename-fields.aut)

; rename fields from `f1', `f2', ..., `f99' to `f001', `f002', ..., `f099'

; go fast

SetKeyDelay, 1

SetWinDelay, 1

; get FileMaker's attention

ATTENTION:

WinActivate, FileMaker Pro - [

IfWinNotActive, FileMaker Pro - [,, Goto, ATTENTION

; open Define Fields

Send, +^d

; Get first field name

Send, +{TAB}{SPACE}{TAB}^c

RenameField:

; exit after f99

StringLen, strLength, clipboard

IfGreater, strLength, 3, Goto, END

; insert zeroes

StringLeft, firstLetter,clipboard,1

StringTrimLeft, digits, clipboard, 1

SetEnv, digits, 00%digits%

StringRight, digits, digits, 3

SetEnv, clipboard, %firstLetter%%digits%

; paste new name and save

Send, ^v!a

; get next field name

Send, +{TAB}{DOWN}{TAB}

CopyName:

Send, ^c

IfEqual, clipboard, AutoIt Clipboard overflow, Goto, CopyName

Goto, RenameField

END:

Exit


[ November 28, 2001: Message edited by: Thom ]

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.