MapBox NumberFormat expected syntax - mapbox

I'm struggling a lot with MapBox Studio
I need to format elevation and use the numberFormat function.
However, I didn't succeed to find the right syntax. The documentation is very poor.
So far I did try to do this:
number-format(elevation, {'locale':'fr'})
but it keep says syntax is not correct. Tried double quote, tried also to add.
I found this only information:
Converts the input number into a string representation using the
providing formatting rules. If set, the "code" argument specifies the
locale to use, as a BCP 47 language tag. If set, the currency
argument specifies an ISO 4217 code to use for currency-style
formatting. If set, the min-fraction-digits and max-fraction-digits
arguments specify the minimum and maximum number of fractional digits
to include.

The right syntax to use seems to be documented there : https://docs.mapbox.com/mapbox-gl-js/example/cluster-html/
For my need, the right way to do it was
[
'number-format',
['get', 'elevation'],
{ 'locale': 'fr' }
]

Related

crystal reports attempting to link two tables by matching string with no luck

As stated in the title, I have two tables I'm attempting to link. Both Strings appear to be a match, however Crystal Reports is not picking it up. The only thing I can think is that that length of the field is different, even though the strings are the same. could that cause a discrepancy? If so how can I correct for it? Thank you
Length of the string will prevent a match. If you are using the Trim(string) function, that only removes spaces found at the beginning or end of your string, so the two strings could still be of different lengths after using this function. You will need to use another function to capture a substring of the original string. To do this you can use the Left(string, length) function to ensure both strings are the same length.
If they still do not match then you may have non-printable characters in one or both of your strings. Carriage Return and Line Feed tend to be the most commonly found non-printable characters. A Carriage Return is represented as Chr(10), while a Line Feed is represented as Chr(13). These are Built In Constants similar to those found in VBA and Visual Basic.
You can use a find and replace to remove them with the following formula. Its not a bad idea to also include the trim and left functions in this as well to ensure you get the best match possible.
Replace(Replace(Left(Trim({YourStringField}), 10),Chr(10), ""),Chr(13), "")
There are a few additional Built In Constants you may need to check for if this doesn't work. A Tab is represented as Chr(9) for example. Its very rare for strings to contain the other Built In Constants though. In most cases Carriage Return and Line Feed are the only ones that are typically found in Plain Text. Tabs and the other constants should only be found in Rich Text and are very rare in string data.

Kentico 9 form fields.. Is there a way to make a feild into a currency field only?

Have a form I am trying to build and even though I have a text box field that will work for users to enter a $ amount it would be nice to make it so that field only accepts numbers and keeps it in the $0.00 format. Seems like a simple thing but I cannot seem to find out how this would be done.
You need to specify the field as a decimal or double and define the precision (depending on what version you are using). The field should NOT be a text field but can use a textbox as the displaying control.
From an output standpoint, it will not automatically output $0.00, you have to format that based on the culture. There are several macros and functions within the API to do this.
Setup you control as followed
make the Data type a decimal number
in the Editing control settings click to show the Advanced section
in Filter set Type to Numbers and Custom
Add Valid characters your delimiter (, or .)
In the validation section add a rule for the minimum value to be 0.
The data type will enforce it to be a actual number.
You could also use as Validation a Regular expression setting something like:
^[$]?([0-9]{1,2})?,?([0-9]{3})?,?([0-9]{3})?(\.[0-9]{2})?[$]?$
which will allow a dollar sign prefix or suffix.

Grafana multivalue float histogram_quantile

Hi I'm forcing problem with histogram_quantile. If I'll set my variable to multi-value so I can repeat panels. Then I got error which says
parse error at char 21: unexpected character: '\'
My request is:
histogram_quantile($percentile, avg((rate(http_server_requests_seconds_bucket{instance=~"$server"}[1m]))) by (le, application))
$Percentile variable is initiated as custom with values as below and multi-value selected
0.9, 0.5, 0.99
The default format for variables escape the . with a backslash, so 0.5 becomes 0\.5.
To not escape ., you can use another format on the variable like this: ${percentile:raw}.
More information on format options here.
The histogram_quantile function requires a single floating point number as an input, and the multi-value feature of Grafana will produce something like 0\.9|0\.5|0\.99 which is not a floating point number. You will need to use multiple expressions for this.

How does "Format editor" for JFormatedTextField in NetBeans work?

I need to edit format for JFormatedTextField in a Java program. NetBeans are "helping" me with something called Format editor. But, I have no clue how the pattern works.
For #,##0.### , it returns 1,234.567, as pictured above. However, I want to change the thousands delimiter to space and decimal separator to comma.
I would guess # ##0,### is the right format, but no, that returns "Malformed pattern # ##0,###".
How can I change the thousand separator to space and decimal to comma? Is that even possible, using Format editor?
It sounds like you're looking for the reference for the java.text.NumberFormat class.
The DecimalFormatSymbols.getGroupingSeparator method looks like it is probably relevant to what you're doing. You will have to choose an appropriate Locale to get the formatting characters you want.
You may need to do something like:
NumberFormat nf = NumberFormat.getInstance(Locale.FRENCH);
with an appropriate parameter to getInstance() for your country and language.

How should I handle digits from different sets of UNICODE digits in the same string?

I am writing a function that transliterates UNICODE digits into ASCII digits, and I am a bit stumped on what to do if the string contains digits from different sets of UNICODE digits. So for example, if I have the string "\x{2463}\x{24F6}" ("④⓶"). Should my function
return 42?
croak that the string contains mixed sets?
carp that the string contains mixed sets and return 42?
give the user an additional argument to specify one of the three above behaviours?
do something else?
Your current function appears to do #1.
I suggest that you should also write another function to do #4, but only when the requirement appears, and not before .
I'm sure Joel wrote about "premature implementation" in a blog article sometime recently, but I can't find it.
I'm not sure I see a problem.
You support numeric conversion from a range of scripts, which is to say, you are aware of the Unicode codepoints for their numeric characters.
If you find an unknown codepoint in your input data, it is an error.
It is up to you what you do in the event of an error; you may insert a space or underscore, or you may abort conversion. What you would do will depend on the environment in which your function executes; it is not something we can tell you.
My initial thought was #4; strictly based on the fact that I like options. However, I changed my mind, when I viewed your function.
The purpose of the function seems to be, simply, to get the resulting digits 0..9. Users may find it useful to send in mixed sets (a feature :) . I'll use it.
If you ever have to handle input in bases greater than 10, you may end up having to treat many variants on the first 6 letters of the Latin alphabet ('ABCDEF') as digits in all their forms.