INTERACT FORUM

More => Old Versions => Media Center 15 (Development Ended) => Topic started by: MrC on August 22, 2010, 01:32:30 pm

Title: [Solved] Grouping expression help (CD Reference ID)
Post by: MrC on August 22, 2010, 01:32:30 pm
Some time ago, Marko helped me create a view that allowed my CD Reference IDs to be grouped in groups of 160, starting from 1 (vs. the built in 0-based list counting).  This required duplicating the search expressions, for as many groupings as I needed, as noted here: http://wiki.jrmediacenter.com/index.php/CD_Reference_Number (http://wiki.jrmediacenter.com/index.php/CD_Reference_Number), but it worked fine for those purposes.

However, I would now like to sub-group those by 10, and as you can see from the grouping in column 2, the groupings are correct for my needs, since they too are 0-based (the first grouping should be 1 - 10).  There are just too many sub-groupings now to attempt to manage creating the individual expressions; furthermore, changing the sub-grouping size to, for example, 40, would require all new expressions.

Is there any other way this can be done?

ps. one of the reasons I'd like to sub-group, is to discover where the holes are in the contiguous list of Ref Ids.  Is there are way to do this quickly?
Title: Re: Grouping expression help
Post by: gappie on August 22, 2010, 03:20:38 pm
have you tried something like
RemoveRight([reference id,0],1)0-RemoveRight([reference id,0],1)9

 :)
gab
Title: Re: Grouping expression help
Post by: wo0zy on August 22, 2010, 03:35:40 pm
Yikes! I have sooo much to learn about this product  :o

I always thought searching by album, artist of track was good enough.

Guess it's time to start working on my understanding of the expression language.

Awesome stuff.

Wo0zy
Title: Re: Grouping expression help
Post by: gappie on August 22, 2010, 03:57:00 pm
Yikes! I have sooo much to learn about this product  :o

I always thought searching by album, artist of track was good enough.

Guess it's time to start working on my understanding of the expression language.

Awesome stuff.

Wo0zy
its fun, just dont get intimidated. it are the out of normal problems that get the weirdest answers..  8)


have you tried something like
RemoveRight([reference id,0],1)0-RemoveRight([reference id,0],1)9

 :)
gab
MrC: when you want that to have a grouping like
1_10
11-20
etc

this is the expression that seems to work for me:
Code: [Select]
Math(RemoveRight(Math([reference id,0]-1),1)0+1)-Math(RemoveRight(math([reference id,0]-1),1)9+1)i expect that that could be done much more elegant..  8)
 :)
gab
Title: Re: Grouping expression help
Post by: MrC on August 22, 2010, 06:57:39 pm
Thanks, that does work for grouping by 10.

I don't understand how the range is being created.  If I simply use "1-10" as an expression, I get no results.  But it seems that the expression just basically does this, so there must be something I'm not understanding about my hard-coded value vs. what is returned by the expression?

[edit: I understand now.  The set of selected items from (typically left-most) categories are applied to the expression.  The expression creates a result, which is a set of labels (categories).  This selected result(s) further reduce the set to those that created the selected label.]
Title: Re: Grouping expression help
Post by: MrC on August 22, 2010, 10:56:28 pm
Here is a more general solution for 1-based grouping by X (replace X by the desired grouping size):
Code: [Select]
PadNumber(Math(X*(FormatNumber(Math(([Ref ID]-1)/X+0.5))-1)+1),4)-
PadNumber(Math(X*(FormatNumber(Math(([Ref ID]-1)/X+0.5))-1)+X),4)

For Search lists, a more general solution to that posted on the CD Reference Number page (http://wiki.jrmediacenter.com/index.php?title=CD_Reference_Number&redirect=no) is (whitespace added for clarity)
Code: [Select]
If(IsEmpty([Ref ID],1),
   Unassigned,
      PadNumber(Math(X*(FormatNumber(Math(([Ref ID]-1)/X+0.5))-1)+1),4)-
      PadNumber(Math(X*(FormatNumber(Math(([Ref ID]-1)/X+0.5))-1)+X),4))

I'll update the Wiki page.
Title: Re: Grouping expression help
Post by: gappie on August 23, 2010, 06:52:13 am
Very nice...  8)

 :)
gab
Title: Re: Grouping expression help
Post by: wo0zy on August 23, 2010, 02:19:37 pm
Here is a more general solution for 1-based grouping by X (replace X by the desired grouping size
Code: [Select]
PadNumber(Math(X*(FormatNumber(Math(([Ref ID]-1)/X+0.5))-1)+1),4)-
PadNumber(Math(X*(FormatNumber(Math(([Ref ID]-1)/X+0.5))-1)+X),4)

For Search lists, a more general solution to that posted on the CD Reference Number page (http://wiki.jrmediacenter.com/index.php?title=CD_Reference_Number&redirect=no) is (whitespace added for clarity)
Code: [Select]
If(IsEmpty([Ref ID],1),
   Unassigned,
      PadNumber(Math(X*(FormatNumber(Math(([Ref ID]-1)/X+0.5))-1)+1),4)-
      PadNumber(Math(X*(FormatNumber(Math(([Ref ID]-1)/X+0.5))-1)+X),4))

I'll update the Wiki page. ;D

That's amazing. If you have the time to walk an expression noob through how this works I know one that'd be happy to learn :)

If not no worries I'll start working my way through the wiki later in the week.

Wo0zy
Title: Re: [Solved] Grouping expression help (CD Reference ID)
Post by: MrC on August 23, 2010, 02:21:18 pm
Thanks.  I explained it here (http://wiki.jrmediacenter.com/index.php/CD_Reference_Number).
Title: Re: [Solved] Grouping expression help (CD Reference ID)
Post by: wo0zy on August 23, 2010, 04:45:14 pm
Thanks.  I explained it here (http://wiki.jrmediacenter.com/index.php/CD_Reference_Number).

Thanks. Digesting now.

Could take me a while :)

Wo0zy