[Mondrian] CurrentDateMember
Julian Hyde
jhyde at pentaho.com
Thu Oct 2 12:29:04 EDT 2008
Looks like a bug in mondrian.util.Format, which implements VB format
strings.
static final Token[] tokens = {
...
nfe(FORMAT_MMM_LOWER , DATE, "mmm", null, "Display the
month as an abbreviation (Jan - Dec)."),
nfe(FORMAT_MMMM_LOWER , DATE, "mmmm", null, "Display the
month as a full month name (January - December)."),
nfe(FORMAT_MMM_UPPER , DATE, "mmm", null, "Display the
month as an abbreviation (Jan - Dec)."),
nfe(FORMAT_MMMM_UPPER , DATE, "mmmm", null, "Display the
month as a full month name (January - December)."),
Note that FORMAT_MMM_UPPER's token is "mmm", should be "MMM".
So "MMM" would have been just ignored, as you noticed. I guess "mmm"
generated "Jan", and mondrian resolved it to "JAN" because member name
resolution is case-insensitive.
I'll fix it very shortly.
Julian
_____
From: Shaffner Joshua [mailto:joshua.shaffner at goodwill.org]
Sent: Thursday, October 02, 2008 9:03 AM
To: jhyde at pentaho.com; Mondrian developer mailing list
Subject: Re: [Mondrian] CurrentDateMember
In db, I have 1 thru 12 for months. Using jpivot w/o CurrentDateMember with
drilldown to month level would generate something like this: [Time].[All
Times].[2006].[May].
Per VB reference, http://www.apostate.com/vb-format-syntax, where it shows
MMM to display the month as abbrev (Jan - Dec), I tried MMM and got no
results. Using mmm however got me the results. It was an accident that I
typed in mmm and got the results. LoL.
Does it mean that the Mondarian is expecting mmm, not MMM?
As for using dimension names, I did try the following but it did not work
unless I remove dimension name.
No results pulled:
{(CurrentDateMember([Time], "['Time']\.[yyyy]\.[mmm]").Lag(13.0) :
CurrentDateMember([Time], "['Time']\.[yyyy]\.[mmm]").Lag(1.0))} ON ROWS
Results pulled:
{(CurrentDateMember([Time], "[yyyy]\.[mmm]").Lag(13.0) :
CurrentDateMember([Time], "[yyyy]\.[mmm]").Lag(1.0))} ON ROWS
PS: Am using biserver_ce 2.0.x
On 10/1/08 7:53 PM, "Julian Hyde" <jhyde at pentaho.com> wrote:
I think the example had extra '\'s because it was taken from Java code
(inside java strings, " and \ need to be escaped). That's why it worked for
you to change '\\.' to '\.'.
If you had changed '\"Time\"' to '"Time"' it would probably have worked too.
It worked without Time because dimension names are optional - although I
recommend using dimension names, because it makes your code clearer and
reduces the amount of searching mondrian has to do.
I also see that you changed MMM to mmm. I'm guessing that in your dimension
months look like 'jan' rather than 'JAN'.
Thanks for letting us know what works.
Julian
_____
From: mondrian-bounces at pentaho.org [mailto:mondrian-bounces at pentaho.org] On
Behalf Of Shaffner Joshua
Sent: Wednesday, October 01, 2008 3:29 PM
To: Mondrian developer mailing list
Subject: Re: [Mondrian] CurrentDateMember
Finally got this working..
Interesting that it works without [\"Time\"]?
CurrentDateMember([Time], '[yyyy]\.[mmm]').Lag(12) :
CurrentDateMember([Time], '[yyyy]\.[mmm]')
On 10/1/08 6:16 PM, "Joshua Shaffner" <joshua.shaffner at goodwill.org> wrote:
Per a couple suggestions in IRC as well as Julian's blog (
http://julianhyde.blogspot.com/2006/10/mondrian-22-cube-designer-and.html),
I tried the query below but to no luck. I either get no results or internal
error. If you see something, let me know. I am stumped...after trying this
and that for a couple hours over just a couple of lines.
SELECT NON EMPTY {[Measures].[Retail Store Sales], <truncated>} ON
COLUMNS,
NON EMPTY
{
CurrentDateMember([Time], '[\"Time\"]\\.[yyyy]\\.[MMM]').Lag(12) :
CurrentDateMember([Time], '[\"Time\"]\\.[yyyy]\\.[MMM]')
}
ON ROWS
from [MRSDS]
where [Organization].[All Organizations].[<truncated>]
PS: I have Time Hierarchy with two levels, year and month.
_____
_______________________________________________
Mondrian mailing list
Mondrian at pentaho.org
http://lists.pentaho.org/mailman/listinfo/mondrian
_____
_______________________________________________
Mondrian mailing list
Mondrian at pentaho.org
http://lists.pentaho.org/mailman/listinfo/mondrian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.pentaho.org/pipermail/mondrian/attachments/20081002/ccc66a77/attachment.html
More information about the Mondrian
mailing list