Thousands Separators

Kay C Lan lan.kc.macmail at gmail.com
Thu Jul 30 02:55:23 CEST 2015


On Tue, Jul 28, 2015 at 9:59 PM, Richard Gaskin <ambassador at fourthworld.com>
wrote:

> But stepping back to look at the big picture, I find myself wondering:
>
> Why is that even necessary?
>
> Why isn't that just a field property, e.g. "the displayFormat"?
>
> But stepping back further, why would you want it only restricted to a
field property? What about if I wanted numbers automatically displayed in
the correct format that came as part of text in an Answer Dialog, or the
default answer in an Ask Dialog, or even in the Title of one of these or
the dynamic label of a button, i.e. Option Menu?

Maybe this is connected with the recent response Mark W gave to the HTML
<H5> tag bug which has been reclassified as an 'enhancement' request where
he responded:

The solution in both cases is not to change the current mappings, but
> instead to (at some point) make the mappings configurable at runtime. Of
> course, the rub here is that this causes a global interoperability problem
> which is not (at this time) clear how to resolve. i.e. In the IDE you could
> be editing two 'applications' at once both of which want different
> settings. (Note that keying this at the stack level isn't necessarily
> correct as stacks can be used as libraries in different contexts - there
> needs to be some notion of 'project scope' which would arbitrate what
> mappings were used when).
>

As I said in my response; "in my naivety this sounds like some kind of LC
CSS is needed."

Wouldn't it be nice, in one central location to nominate formats, not just
number, and be able to English like name them for use anywhere (hopefully
LC would come with a bunch of inbuilt ones).

set the CSSformat $#,###.00 = "currency"
set the CSSformat #,### = "wholeThousands"
set the CSSformat (###) ####-#### = "AreaPhone"
(possibly grep based)
set the CSSformat \d{4}-\d{2}-\d{2} \d{2}:\d{2}\d{2} = "SQLDateTime"
set the CSSformat \d{2} \w{3} \d{2} = "dd mmm yyDate"
set the CSSformat \w+ at gmail.com = "gmailEmail"

A stack could then be set to 'wholeThousands'

use CSSformat "wholeThousands" for this stack

and then every number, whether field, title or text in an Answer Dialog
would come up with a thousand separator. If a particular field needed a
different format, as you say you'd just set it's format property to: use
CSSFormat  "currency" for fld "price" to override the default.

It would also be nice to be able to tick a box for a field property that
automatically invoked data format checking or be able to specify it
elsewhere.

--number format assumed to be "currency" because that is the stacks default
ask question "How much did you spend?" with tValue titled "Lunch
Expediture" AND formatCheck 1

--number format different to stack default
ask question "Which day was the purchase" with tDate useCSSformat "dd mmm
yyDate" titled "Lunch Expenditure" AND formatCheck 2

In the LC CSS you'd specify the response for a 1, 2, 3... etc formatCheck
failure.

Sitting here dreaming of LC heaven :-)


More information about the use-livecode mailing list