Adding suffixes to collectors in the field format editor

Hi @Elizabeth - In 7.9.3 I created a Collector formatted view where (primary) appeared as a suffix after a Collector’s name, when they have isPrimary ticked.
I was doing this with the following xml:

<format name="Collector" title="Collector" class="edu.ku.brc.specify.datamodel.Collector" default="true">
		<switch single="false" field="isPrimary">
			<fields value="true">
				<field sep=" ">agent.text3</field>
				<field type="boolean" format=" " sep=" (primary)">isPrimary</field>
			</fields>
			<fields value="false">
				<field>agent.text3</field>
			</fields>
		</switch>
	</format>

I can’t see how I would do this with the new visual interface in 7.9.4. We have deployed 7.9.4 in a test instance, and I can apply the xml above via the xml editor, and it works as it does in 7.9.3. But is there a way to achieve the same result using the visual editor?

The only option I think would be to keep the conditional format, but remove the isPrimary field from the ‘true’ option config, and then have a '(primary) ’ separator for text3, which would put the '(primary) ’ in front of the text3 name. Not ideal.

Think the xml would be:

<format name="Collector" title="Collector" class="edu.ku.brc.specify.datamodel.Collector" default="true">
		<switch single="false" field="isPrimary">
			<fields value="true">
				<field sep="(primary) ">agent.text3</field>				
			</fields>
			<fields value="false">
				<field>agent.text3</field>
			</fields>
		</switch>
	</format>

I tried to select something from the ‘Custom Field Format’ and it appeared in the xml as ‘uifieldformatter’ rather than ‘format’ like in my original xml. And editing the xml to be uifieldformatter=" " doesn’t do anything.

Is there a way to add to the ‘Custom Field Format’ drop down, so you can make a field appear either as an empty string (and use the separator field for the actual display value) or appear as a particular string you can specify?

Or is it possible to add a suffix to a formatter? Similar to how you can add one to an aggregation.

I can continue to override the visual editor with my specific xml tweaks, but I worry it may get overridden itself if the formatter is tweaked by someone else using the visual editor.

Thanks,
Zoe

Hi Zoe, based on the xml you provided this should be how the visual editor should look to achieve the same results you had in 7.9.3.


If this does not give you the results you were looking for then we can discuss potential alternate solutions to get the desired result!

Thanks,
Elizabeth

Thanks @Elizabeth for your response,
I should have included screenshots of the actual output.
With my specific xml tweaks, the collector formatted/aggregated view displays as follows
image

If I configure it as you suggest, just through the visual editor, it displays like this - with the ‘1’ from the boolean field. I’m trying not to have 1 appear (effectively have ‘(primary)’ appear instead of ‘1’.
image

The underlying xml when just using the visual editor is now this:

<format name="Collector" title="Collector" class="edu.ku.brc.specify.datamodel.Collector" default="true">
		<switch single="false" field="isPrimary">
			<fields value="true">
				<field sep=" ">agent.lastName</field>
				<field sep=" , ">agent.firstName</field>
				<field sep="  (primary)">isPrimary</field>
			</fields>
			<fields value="false">
				<field>agent.lastName</field>
				<field sep=" , ">agent.firstName</field>
			</fields>
		</switch>

You can see it differs to my customisation, by not specifying a format for the boolean field.

Thanks,
Zoe

Thank you for the screenshots @zoe.warner! At this time, modifying the format attribute for fields in a table format isn’t possible. Formatting a boolean field with a field format is also currently unsupported. However, manually setting the format for a field in a table format with the xml editor will not be overwritten. Even if changes are made to the format using the visual editor, the boolean field format will remain unless the conditional format is unchecked in the visual editor.