Global Styling Question for numbers

I was wondering if there was a setting to get the system to globally style numbers based on the value of the number. The rule we use is that for numbers 10 and below, the number is spelled out, but for numbers above 10 you use the numerals. For example, 6 should always be six and 12 would be 12 in our documents.

Currently, I use coding that compares the data field and applies the @fullnr feature if necessary. It looks something like {#concept^datafield<10: @fullnr(#concept^datafiled)| else: #concept^datafield}. I don’t think I could use an external snippet, because #concept^datafield would vary.

Is there another solution other than using the code above in each clause that references a number?

There are actually two solutions:

  1. See Styling → Locale:

The selected option then rsults in the following:

  1. More in general, it is actually possible to use an external snippet with a datafield that constantly changes. This is what the “Parameters” is all about, see the Help site to read more about it. At first glance it appears as a fairly advanced subject, but is actly the generic solution you should have used if the Styling → Locale would not have existed.

The idea is that your external snippet does not “hard-code” a specific datafield — because that datafield is always different — but instead uses a “parameter”. That parameter can then be filled in with some different datafield every time you use the snippet.

The external snippet in question (let’s call it “NR-SNIP”, but any other name could do) would have the following content:

image

You can then include it in a random clause with a random datafield, as follows:

image

Essentially, you are telling the software to include the NR-SNIP external snippet, but to replace the ?NR parameter with the #some-random^datafield content.

By the way, it does not need to be a datafield, you could actually include anything (hardcoded number, special function, …) that would ultimately result in a number. For example,

will then result in:

image

Thanks this is really helpful. Is there a similar setting for ordinals? For example, if my ordinal is below 10 I want it spelled out (first instead of 1st) and if over 10 I want it in digits (13th instead of thirteenth).

@ord returns the ordinal spelled out up to 20 and in a digit-version above 20, while @short-ord always uses the digit-version.

So:

returns:

image

If you want to lower this number to 10 (instead of 20), you could have an external snippet (let’s call it “ord”) that says:

image

and then call it as follows:

which would lead to

image

Maarten,

I am having trouble with the global styling setting. I have it set as our default and I have a template, where I am still getting twenty-four instead of 24. It’s file #1009058 (which is a binder, but I have the same setting in the underlying document which is file #1008953). Could you check it out and let me know if we are experiencing a bug or if I am making an error in my binder construction?

Thanks,
Elmer

Hi Elmer,

I suppose you’re talking about the “Numbers in body text” setting, right?

In your default style at the customer level, it is currently configured as follows:

However, in the particular Binder you are referencing, you have configured it differently:

As explained on the Help page, there is a “cascading” system of styles, where the styling at the level of an individual document/binder takes precedence over the setting at the user’s level, which takes precedence over the setting at the customer’s level.

When creating a temporary dummy article in your Binder, it does seem to work correctly (in the sense that it’s reflecting “Letters if 0-9, else digits”):

Does this help you?

I understand what you are saying conceptually, but it still does not seem to be working. I went into the styles and created a new Locale syle and assigned that to our base user and advanced user groups. However, when I log into the Q&A for my template, I am still getting this output.

As you can see 24 is still coming out as twenty-four.

I used the admin account to login under the test user name associated with your email in our user list and I got the same output from that account.

The clause here has a lot of heavy programming (see clause #1008959). Is it possible I somehow changed the datafield type?