I also have a question around custom orders on vis...
# gd-beginners
I also have a question around custom orders on visuals To maintain an order we have to put prefixes in. We would rather not have these prefixes visible. Is there a way have a sort order that can be set up in a custom way? or have the order be determined by an alpha-numeric sort but have some way to display different text on the visuals?
For custom sorting of attributes, you can use the sorting label in your data model. Basically you add another label (column) to the attribute and set it as a “sorting label”. Then you can display one label and have it sorted (alphabetically/numerically) by another label. Note that this will only work for attribute values, not sorting of metrics. (From your screenshot I am not sure of that is five values of an attribue or five metrics).
thanks @William Whelan looks like solution worth trying to implement today
@Michal Hauzírek So I have an integer value in a field which is an attribute of a fact. For display purposes (and because GoodData currently doesn’t allow one field to be both a fact and attribute) I have a text description of that integer which is grouped/binned for easier display in visuals. I tried sorting the binned variable by the integer variable but this appears to force the integer values to be used in the visual and I lose the groups/bins. It looks like I need to create a copy of the groups/bins field and provide a sort order for the same bins. Is this accurate? and it looks to me like the desired solution here is to create a lookup table for integer to text groupings and push that off to the side in the LDM rather than holding all that grouping/binning logic within the fact table. Is that how most people would solve this problem?
This must be quite a common thing that people want to do on the platform - integers are often used as attributes (e.g. quantity on an order) and it is often required to bin them for reporting. So what is the ‘standard’ solution for this
In addition, is there a way to do this lookup with ranges? e.g. if I have an integer attribute that represents the quantity of an order and I want to bin this in the visuals as 1, 2-3, 4-5, 6-10, 10+ then ideally I’d want to just load up a 5 row table that contained the ranges. Does the LDM allow for this kind of thing? or would I need to create a table that had one row per integer up to some large amount and then list all the groupings next to it. e.g.
Copy code
1    '1'
2    '2-3'
3    '2-3'
4    '4-5'
5    '4-5'
6    '6-10'
7    '6-10'
etc I mean I know it is easy to produce such a table - I just want to know if there is a more elegant solution
Actually, I just realized that in GD Cloud you don’t even need to create a label for sorting an attibute. You can just select which database column to sort the attribute by in the modeller. And it can even be a column which is mapped to a fact or not mapped to any GoodData object at all. Have you changed the “Sort by…“? That should change the sorting. BTW regarding mappings. you should now be able to map a single database column to a multiple objects (i.e. an attribute and a fact). It will just display a warning, but should work OK. And regarding the ranges - I don’t think there are currently many ways how to do it directly in GoodData. It is not possible in MAQL. So one option could be to do it with SQL in “SQL dataset” (basically a named query stored within the GoodData model under your dataset instead of a physical table or view). But that is still marked as Beta.