Undefined Template Fields

  • Skill Level: Advanced and Intermediate
  • FH versions: V8
  • Download type: Smart Folders (V8) 

Two smart folder sets that find template field values which the source’s template does not define, and let you remove them many at a time.

What These Are For

A templated source keeps its details in fields that the Source Template defines. Sometimes a Source record or a citation is left holding a value for a field that its template does not define. This can happen when a field is deleted from a template while values for it still exist, when a source is switched to a different template, or when the template is removed from a source altogether.

ƒh keeps these values but hides them. They do not appear on the Main tab of the Property Box. They appear only on the All tab, labelled Undefined Template Field followed by the field’s name in brackets.

These folder sets list every such value in a project, so that you can remove the ones you no longer want. There are two to download:

  • Undefined Source Fields.fhsf lists values held by Source records.
  • Undefined Citation Fields.fhsf lists values held by citations.

You need ƒh Version 8. Smart folders are not available in earlier versions.

Before You Start

Removing a value deletes it from your project. Take a backup first, using File > Backup/Restore, or at least make sure you have a recent one.

Installing the Folder Sets

  1. Download the two .fhsf files and save them somewhere you can find them, such as your Downloads folder.
  2. In ƒh, click the Query button on the main toolbar and choose Manage Folder Sets…
  3. Click Import…, select Undefined Source Fields.fhsf and click Open.
  4. ƒh warns that folder sets can contain plugins and asks you to confirm that you trust the source. Click OK. (Each of these folder sets contains a small script. It only reads your project to build the list. It cannot change your project data.)
  5. A message confirms that the folder set has been installed. Click OK.
  6. Repeat steps 3 to 5 for Undefined Citation Fields.fhsf.

If you import the same file twice, ƒh keeps both and adds (2) to the name of the second. To replace a folder set, select the old one in the list and click Delete before you import the new one.

Finding Undefined Fields

  1. In the Manage Folder Sets window, select Undefined Source Fields and click Open. (Another way: click the Query button, choose Smart Folders, then pick the folder set from the Folder Set list at the top of the left-hand pane. Custom folder sets have (custom) after their names.)
  2. The left-hand pane shows a folder called Undefined fields with a number in brackets. The number is how many Source records hold at least one undefined field. If it is 0, there is nothing to do in this folder set.
  3. Click the + beside Undefined fields. Inside is one folder for each undefined field, named after the field’s data reference, for example %SOUR.~TX-DB_DESCRIPTOR% (12). The number is how many Source records hold a value for that field.
  4. Click one of these folders to list those Source records on the right. If the Property Box is open, click a record to see it there. The value itself is on the All tab.

If a folder name is too long to read, use the scroll bar at the bottom of the left-hand pane.

A Source record that has no template at all, but still holds field values, is listed too.

Undefined Citation Fields works in the same way. It lists citations rather than Source records, and its data references begin %~SOUR. rather than %SOUR., for example %~SOUR.~TX-PAGE_NUMBER% (3).

Removing a Field’s Values

You remove one field at a time. The steps are the same in both folder sets.

  1. Expand Undefined fields and write down the name of the folder for the field you want to remove, exactly as shown, including the % at each end. In these steps the example is %SOUR.~TX-DB_DESCRIPTOR%.
  2. Click the Design Mode button. It is the middle one of the three small buttons to the right of the Folder Set list. (You can also click the cog button beside it and choose Enable Design Mode.) The left-hand pane changes colour to show that Design Mode is on.
  3. In the left-hand pane, click Undefined fields. The right-hand side now shows a Columns tab with a list headed Columns.
  4. In that list, click Field to remove. Below the list, the Expression box shows %SOUR.~TX-FIELD_NAME[1]% (or %~SOUR.~TX-FIELD_NAME[1]% in the citations folder set).
  5. Delete what is in the Expression box and type the name you wrote down in step 1.
  6. Click Apply Changes.
  7. Click the Design Mode button again to switch Design Mode off.
  8. Expand Undefined fields and click the folder whose name matches what you typed. The Field to remove column on the right now shows the values.
  9. Click a cell in the Field to remove column. To select several, click the first cell, hold down Shift and click the last cell in the same column. If there is only one value, just click its cell. A single selected cell has a dark outline rather than a coloured highlight.
  10. Press the Delete key (often marked Del). ƒh tells you how many fields will be deleted and asks you to confirm. Check that the message says fields and that the number is what you expect, then click OK.
  11. Click the Refresh button, the first of the three small buttons. The folder for that field disappears from the list, because nothing holds a value for it any more.

To remove another field, repeat the steps with its name.

To remove only some of the values, select fewer cells in step 9.

Important: Use the Matching Folder and the Right Column

Always select the cells in the folder whose name matches the Expression you typed. That folder lists only the records where the field is undefined.

The other folders may show values in the Field to remove column too. In those folders the field may be properly defined by the source’s template, and deleting it there would remove information you want to keep.

Select cells only in the Field to remove column. The Delete key acts on whichever cell is selected. In the other columns it offers to delete the whole Source record, or the record that cites it. ƒh always asks first. If the message mentions a record rather than fields, click Cancel.

If Pressing Delete Does Nothing

  • Click the cell first. When you click a folder on the left, the keyboard stays with the folder list, even though the first cell on the right is outlined. Click the cell in the Field to remove column, then press Delete.
  • Use the Delete key, not Backspace. Backspace does nothing here.
  • There is no menu command for this. The Delete key is the only way.
  • If ƒh says No data items found in the selected cells, the cell is empty. Check that the Expression you typed in step 5 matches the name of the folder you clicked.

If You Change Your Mind

Nothing is final until you save. Straight after deleting, you can use Edit > Undo to put the values back. If you have already done other things, close the project without saving, or restore your backup.

When you are happy with the result, save the project in the usual way.

Good to Know

These folder sets list only fields that the template does not define. If you added a field back to a template so that you could see its values, it is defined again and will not be listed.

The folder sets do not change your Source Templates.

They work on whichever project is open, and stay installed until you remove them. To remove one, open Manage Folder Sets, select it and click Delete.

Downloads