# Add constant to Record Formatter

**URL:** <https://speciforum.org/t/add-constant-to-record-formatter/4150>\
**Category:** Get Help\
**Tags:** Feature-Requested\
**Created:** [September 4, 2026, 8:55am UTC](https://speciforum.org/t/add-constant-to-record-formatter/4150 "2026-09-04T08:55:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![fedoras](https://yyz1.discourse-cdn.com/flex029/user_avatar/speciforum.org/fedoras/32/455_2.png) [@fedoras](https://speciforum.org/u/fedoras)\
**Post date:** [September 4, 2026, 8:55am UTC](https://speciforum.org/t/add-constant-to-record-formatter/4150/1 "2026-09-04T08:55:33Z")

</div>

Why is it only possible to add fields to table formatter and separators, but no string constants? I had to hack the following solutions, mass-writing the closing parenthesis to the Text8 field, which is not an elegant nor reliable solution:

 ![image](https://canada1.discourse-cdn.com/flex029/uploads/specifysoftware/original/2X/b/b04c0ef91bb4048999f55f749f418844e3b20b65.png)

---

<div class="post-metadata">

**Author:** ![bronwyn](https://yyz1.discourse-cdn.com/flex029/user_avatar/speciforum.org/bronwyn/32/5742_2.png) [@bronwyn](https://speciforum.org/u/bronwyn)\
**Post date:** [September 4, 2026, 5:30pm UTC](https://speciforum.org/t/add-constant-to-record-formatter/4150/2 "2026-09-04T17:30:26Z")

</div>

Hi @fedoras,

You make very valid points. In fact, the ability to add static or constant values to a table format independent of a field is an existing request on GitHub: [Support postfixes and static separators in table formats · Issue #6066 · specify/specify7 · GitHub](https://github.com/specify/specify7/issues/6066).

I’ve commented with your report there and also added the `UX` tag to indicate that multiple users have encountered and requested this.

Thanks for reaching out!

:specify:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex029/uploads/specifysoftware/original/2X/1/18a843c97bc32b40e8ad0e035755bc88ffaacaf7.svg) [@system](https://speciforum.org/u/system)\
**Post date:** [September 11, 2026, 5:30pm UTC](https://speciforum.org/t/add-constant-to-record-formatter/4150/3 "2026-09-11T17:30:36Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

---

<div class="post-metadata">

**Author:** ![Grant](https://yyz1.discourse-cdn.com/flex029/user_avatar/speciforum.org/grant/32/4255_2.png) [@Grant](https://speciforum.org/u/Grant)\
**Post date:** [September 14, 2026, 8:31am UTC](https://speciforum.org/t/add-constant-to-record-formatter/4150/4 "2026-09-14T08:31:50Z")

</div>

Hi @fedoras,

If you are willing to edit the XML, you can actually achieve this by using a [sprintf](https://www.php.net/manual/en/function.sprintf.php) expression. No need to waste a field! All that is missing is an option to configure something like this in the UI.

See below:

```xml
	<format name="CollectionObject" title="CollectionObject" class="edu.ku.brc.specify.datamodel.CollectionObject" default="true">
		<switch single="true">
			<fields>
				<field uifieldformatter="CatalogNumber">catalogNumber</field>
				<field format="(%s)">altCatalogNumber</field>
			</fields>
		</switch>
	</format>

```

 ![image](https://canada1.discourse-cdn.com/flex029/uploads/specifysoftware/original/2X/4/493909535cb2046764e4ac3cc08dab04d2592ae7.png)

---

<div class="post-metadata">

**Author:** ![Grant](https://yyz1.discourse-cdn.com/flex029/user_avatar/speciforum.org/grant/32/4255_2.png) [@Grant](https://speciforum.org/u/Grant)\
**Post date:** [September 26, 2026, 1:52pm UTC](https://speciforum.org/t/add-constant-to-record-formatter/4150/5 "2026-09-26T13:52:07Z")

</div>

Hi @fedoras,

This will be in 7.12.2!

> <https://github.com/specify/specify7/pull/8552>
>
> Fixes #6066
> 
> This adds support for \*\*static text\*\* and \*\*field-level display f…ormats\*\* in table formatters.   
> 
> At long last, you can add text \*before\* or \*after\* a given field and define static text entries without using a database field or editing XML.
> 
> \- Preserve static text when a field is not mapped  
> \- Support field display formats such as \`(%s)\` and \`%s/\` by letting the user enter either a text before or text after value.
> \- Add static text and field format controls to the formatter editor.  
> \- Updates the preview so we can see it both when editing and after running a query
> 
> \<img width="322" height="377" alt="image" src="https://github.com/user-attachments/assets/698e0149-fc84-4c6e-a711-c0edf3379af8" /\>
> 
> 
> \### Checklist
> 
> \- \[x\] Self-review the PR after opening it to make sure the changes look good and self-explanatory (or properly documented)  
> \- \[x\] Add automated tests
> 
> \### Testing instructions
> 
> 1. Open the table formatter editor.  
> 2. Select a field and enter text before and/or after the field placeholder.  
> 3. Add a static text row and verify that it remains after saving and re-opening the formatter.  
> 4. Preview records with both populated and empty fields.  
> 5. Run a query and verify the format you defined appears correctly.  
> 6. Export the results to CSV and verify that the format is preserved.
> 
> 
> \## Summary by CodeRabbit
> 
> \* \*\*New Features\*\*
> \* Added support for static text, prefixes, suffixes, separators, and display formats in formatter fields.
> \* Formatter values can use \`%s\` and \`%d\` substitutions for customized output.
> \* Added separate editors and labels for display formats and field formats.
> \* Added localized “Display Format” labels across supported languages.
> 
> \* \*\*Bug Fixes\*\*
> \* Improved formatting for empty fields and formatters containing only static text.
> \* Preserved static formatter entries when no mapped field is selected.
