Techniques:
- iterate through all fields ; createList for each (which CreateSessionObject separate individual lists) (via
createListAPI)- To get list of fields in the first place, loops through the Current Selections bar DOM. Don't know why it doesnt at least use one of the below techniques, which reliably return which fields have selections.
- For each App API createList method call with
{ qDef: ... }I believe it must translate into similar as the CreateSessionObject below with{ qListObjectDef: ...}... there is no direct EngineCreateListmethod
- getList "SelectionObject" which calls "CreateSessionObject" of type "SelectionObject" (via
fieldAPI)- The only way to get comprehensive results, i.e. the SelectionObject is just as limited as the CurrentSelections object is (see qSelectionThreshold). i.e. the .qSelectionObject.qSelections[1].qSelectedFieldSelectionInfo will still only be max 6 elements long.
- However still may not have all fields' selections in it; must call app.field(...).getData(...). Looks like that will eventually CreateSessionObject with
{ qListObjectDef: ... }and GetLayout. (Interestingly itsqInfo.typeis 'mashup', maybe because thefieldAPI is part of the "Capability" API aka the "Mashup API". Still Qlik understands the object to be a list because ofqListObjectDef.
- Selections API ; undercover calls "CreateSessionObject" of type "CurrentSelections"
- But this API is limited to what CurrentSelections shows; i.e. limited to the qSelectionThreshold which is set at 6.
- While this method limits the results you can access, it still has a big advantage; it is the only one of these methods which is callback-based; so that you can listen and be notified if the selection even changes at all; i.e. gives you opportunity to do the work closer to when the user applies the selection. So just doing work when teh callback is called.
- However,when the callback is called, it is not passed any arguments, i.e. so it's not "incremental" where you can track which fields you should check for an update in selections.
- But regardless of getting full detail selections is convenient that this
selectionStateAPI will keep an array for you, you'll never need to iterate through fields again.