DynaRange: Sort by two attributes?

    DynaRange: Sort by two attributes?

    Hi,

    I have a Dynarange that contains elements with several attributes, "group" and "description" for example.
    Now I want to sort by group first and then by description.
    In dynarange's attribute filter I can only specify one attribute as sort criteria.

    Is there a way for "multiple sorting"?

    Thanks for your replies
    Florian
    Thank you for this, the posted site will help me in two other issues ;) Thanks lot.

    But in this case I do not sort for dimensions. I have only one dimension displayed and every element has several attributes so these filters will not work.
    But I think that's not really a problem... Having the output sorted was nice but if there's no way.. it does not really matter. Just a optical think in the report...
    actually this is possible using macros:

    1/ you arrange to get your elements and their 2 (or more) attribute values in an array, formatted like this:

    Source Code

    1. $data=array(
    2. array('Regions'=>'France','Population'=>'70','Language'=>'French'),
    3. array('Regions'=>'Germany','Population'=>'80','Language'=>'German'),
    4. array('Regions'=>'Belgium','Population'=>'12','Language'=>'French')
    5. );

    2/ You use array_multisort on this array, more info here: stackoverflow.com/questions/45…array-by-two-field-values

    Source Code

    1. foreach ($data as $key => $row) {
    2. $population[$key] = $row['Population'];
    3. $language[$key] = $row['Language'];
    4. }
    5. // Sort the data with volume descending, edition ascending
    6. array_multisort($population, SORT_ASC, $language, SORT_ASC, $data);


    I've not tested though but this should work

    hope this helps!
    laloune

    Post hoc, non est propter hoc

    laloune wrote:

    what do you mean "get a dimension into an array"?

    do you mean subset on a dimension?


    I think I need to have all elements of a dimension in an array. In web reports I always used dynaranges, I never worked with subsets.
    I just took a look into admin guide and subset seems to give back a list of elements and I should be able to get this subset inside a macro and work with these elements.

    I'll try this...
    I think I need to have all elements of a dimension in an array.


    for that you would use a subset (as well as array functions such as palo_element_list_children), and define it using application()->PALO_SUBSET. You can find examples in the Demo package in Jedox Web I guess

    In web reports I always used dynaranges, I never worked with subsets.


    actually you did already, a subset is the definition of the information returned in your dynarange, meaning the combination of the filters that you define in the Editor
    laloune

    Post hoc, non est propter hoc

    laloune wrote:

    Hi Florian,

    yep, this would be what you are looking for: jedox.com/en/multiple-data-subsets


    Just FYI, as of version 6, you can also use multiple DFilters in Subset formula itself. By default the result sets are joined using "or", you can switch to using "and" (i.e. only include elements that in result set of either DFilter) by setting eighth param of the latter PALO.DFILTER formula(s) to TRUE. Details are in Whats new document.

    dominik_l wrote:


    Just FYI, as of version 6, you can also use multiple DFilters in Subset formula itself. By default the result sets are joined using "or", you can switch to using "and" (i.e. only include elements that in result set of either DFilter) by setting eighth param of the latter PALO.DFILTER formula(s) to TRUE. Details are in Whats new document.


    What is the syntax to use two DFILTER arguments?

    Source Code

    1. =PALO.SUBSET(@db,"Z_PERSON",1,,PALO.HFILTER(,false,false,2,,,,,),,,,PALO.DFILTER(PALO.SUBCUBE("PERSON",,DynaRange10,"*","*","*","*","*","*"),{">",0},,,,0),PALO.SORT(1,0,,0,,0,1))


    is my formula for a dynarange nested in another dynarange. Now I want to use another DFILTER for another cube that also has the same PERSON-Dimension the first DFILTER uses already.
    The two DFILTERS should be linked with "AND".

    Post was edited 1 time, last by “fnsl” ().