1. I have corrected the e-mail settings so that outgoing e-mails from these forums should be sent now. If you tried to Register or Reset your Password, please try again!
    Dismiss Notice

Sorting after c:join

Discussion in 'Census: DCUO' started by Neuro, Sep 9, 2014.

  1. Neuro

    Neuro Guest

    Hi. I'm trying to sort a joined JSON query but it doesn't work the way I want it to. Well, actually it doesn't work at all.

    Take this query for example:


    I'm planning to sort all items in character_list.z_MissingFeats by character_list.z_MissingFeats.FeatInfo.FeatCategory.category_name.en

    Trying to use c:sort=z_MissingFeats results in an error, because it's not a viable field of character_list. Is there any way I can sort it the way I'm planning to, without having to code it via JScript after I got the result?
  2. Sore

    Sore Guest

    I don't think you can sort by what you've joined in, especially sorting in a child list. You can only sort by your primary collection. You can still get the same data by inverting your query. Instead of "character->characters_active_feat(list)->feat->feat_category" you can go "feat_category->feat->characters_active_feat(terms:character_id)->character" and have all the same data in a different format sorted how you're asking. It just adds duplication in terms of character data being presented. I would hide/show aggressively to make that a manageable result set. You probably don't even need to pull in "character" if you're okay letting that come into your app via a separate query.

  3. Neuro

    Neuro Guest

    Hi Sore. Thanks for the quick reply!

    Thing is.. I'd like to implement both the possibility to check missing feats by entering your character name (if possible without doing it with 2 seperate queries) and sorting primarily by feat category, then secondarily by feat name. But okay, if it's impossible to sort by child lists, I'll do the sorting via JS.

    Is it possible to use inject_at to inject data to the parent object by any chance? Like injecting the value for FeatInfo.FeatCategory.name directly into FeatInfo.name via c:tree or something like that?
  4. Sore

    Sore Guest

    I'm still trying wrap my head around how inject_at and tree function. I'm little-to-no help there. I've resorted to sorting in code for some things since in-memory processing is cheap considering how dwarfed it is to the performance of any external resource access.
  5. Sore

    Sore Guest

    I did just register my own service is since we all should. I feel better about not running into the 10 query / minute threshold.
  6. Dedith

    Dedith Guest

    As I mentioned elsewhere in the past... Census is going to require separate data pulls.. a lot. lookup the character, then lookup up the character_feat collection, then the feats. You can put many feats into a single pull, and since feats are generally static data.. store them in a local db so you don't have to look them up later. Cache is awesome for static Census data.
  7. Feldon

    Feldon Guest

    We should be using the Beta forums to get this stuff sorted, cause right now it's done from a DBA's viewpoint rather than a game design or user's viewpoint. I can understand how that happens, but DCUO Census could be dramatically improved with a few sensible joins and resolves.
  8. Superskull85

    Superskull85 Guest

    Whoops did not see that this was already asked for. I have another example of how I would like to use this functionality in this thread: [url="https://forums.station.sony.com/soe/index.php?threads/using-c-sort-with-c-join-sort-by-join-field.11500064778/" class="internalLink">https://forums.station.sony.com/soe...t-with-c-join-sort-by-join-field.11500064778/[/url]
  9. Superskull85

    Superskull85 Guest

    Not sure if you have figured it out yet but instead of using, say, "c:join=character^on:character_id" you would use "c:join=character^inject_at:charater_id". The difference is the character_id value would be replaced by a character hash. ON would give you a separate hash entry called "character_join_character_id".

    I personally use inject instead of join to make the result clearer. If I need the original field value I just show it the inject. Usually not needed though as you would inject because you don't really need the ID but instead the specific data that the ID links to.

Share This Page