David Huynh wrote:
> Lee Feigenbaum wrote:
>> [snip]
>>> and then try this expression
>>>    .quantity * .cost
>>> Please note the spaces surrounding *. The expression parser is flaky 
>>> at the moment.
>> ...but I can't get this to work. I get the error:
>>
>> """
>> Caught exception: TabularView: Error processing configuration of 
>> tabular view.
>>
>> Details: Error: Extra text found at the end of the code
>> """
>>
>> I'm doing stuff like:
>>
>> <div ex:role="exhibit-view"
>>      ...
>>      ex:columns=".foo, .bar, .x * .y"
>>      ...
>> >
> It was a bug in my already flaky expression parser... I've just 
> committed a fix. Could you try again and see if it works for you now?

I actually made a fix to solve the problem in my local copy of 
expression.js, involving adding a ? modifier to \s in the operator 
regular expressions. I have some other small changes in expression.js 
that are in flux, so I haven't updated yet...

> By the way, if you're using FireBug, then it's quite easy to try what 
> works and what doesn't by going to a page that has Exhibit and then 
> executing something like this in FireBug's console:
> 
>    try { Exhibit.Expression.parse(".x * .y") } catch (e) { 
> console.log(e); }
> 
> FireBug really makes my work so much easier...

I've had major problems with Firebug in the past, but maybe I'll try it 
anew.

>>> Cool! What other formats can you think of that demand special handling?
>> Off the top of my head? Not much :-) I did realize that adding a new 
>> format isn't as simple as I thought. There are other places that treat 
>> numbers specially, and since currency is a type of number, it needed 
>> special treatment also. (For example, to get currency ranges to work 
>> correctly in the new range facets.)
> Excel has the following formatting options:
> - general
> - number (number of decimal places, use thousand separators?, indicate 
> negative numbers with red or with parentheses)
> - currency (number of decimal places, symbol, negative number indication)
> - accounting (number of decimal places, symbol)
> - date
> - time
> - percentage (decimal places)
> - fraction (up to X digits)
> - scientific (decimal places)
> - text
> - special (zip code, zip code + 4, phone number, social security number)
> - custom (roll your own format template)
> 
> Maybe we can start with that. Timeline has this notion of "labelers". I 
> can try to adapt it for Exhibit.

So I encountered further problems with my currency valueType hack -- in 
this case it was that I wanted the result of multiplying currency*number 
to be a number, but the operator type stuff is not easily amenable to 
that. For now, I actually modified the tabular-view to allow me to 
specify in the DOM column stylers, and I'm using a column styler to 
display my currency values (since this allows me to do both my pure 
currency data item and my calculated currency value). Of course, this is 
an inferior approach since it's specific to the table view... But I 
decided it was best for me for the moment since I kept running into new 
places that would need to be made aware of the currency datatype.

In writing the currency displayer, it occurred to me that for my 
purposes, the ability to use printf()-like patterns to specify how to 
format my numeric data items might be somewhat of a compromise approach.

Lee
_______________________________________________
General mailing list
[email protected]
http://simile.mit.edu/mailman/listinfo/general

Reply via email to