Design Studio SDK: Collection Util Component
Tags:
Purpose
Work with Collections with sorting feature. This is usefull when you have some arrays, which you want to put together and sort.
This component is created with collaboration with @Michael Howles.
Thanks Michael for allowing the reuse of the sorting-code from your blog Design Studio SDK - Get Top/Bottom N rankings with a little less code, as response on my primitive blog How to get "Top X" our of resultset
Supports
Items with
- key
- label
- value
-> See also available extensions in How to Use Extended Sdk Collection to handle "properties"
Functions
Function | Description |
---|---|
void setItems ( /*keys*/ String keys, /*labels*/ String labels, /*values*/ String values, /*separator*/ optional String separator) | initialization with 3 arrays, ideally all 3 are equal, if not, the loop is on keys:
Default Separator is comma , |
void addItem ( /*key*/ String key, /*label*/ String label, /*value*/ String value) | you can add items one by one as well |
String getKeys( /*separator*/ optional String separator) | keys separated by separator Default Separator is comma , |
String getLabels( /*separator*/ optional String separator) | values separated by separator Default Separator is comma , |
String getValues( /*separator*/ optional String separator) | values separated by separator Default Separator is comma , |
void sortBy...() | some sort methods (provided by Michael) |
int getLength() | length of current array |
String getLabelByIndex( /* index */ int index) | getLabelByIndex |
String getLabelByKey( /* index */ String key) | getLabelByKey |
String getValueByIndexAsString( /* index */ int index) | getValueByIndexAsString |
float getValueByIndex( /* index */ int index) | getValueByIndex |
String getValueByKeyAsString( /* key */ String key) | getValueByKeyAsString |
float getValueByKey( /* index */ String key) | getValueByKey |
The Coolest Function
Function | Description |
---|---|
org.kalisz.karol.scn.pack.KeyLabelValueArray getAsKeyLabelValueArray ( /**max members*/ optional int maxMembers) | returns the complete collection of keys, labels, values as JSON loopable object maxMembers can restrict the length of the returned array |
Example Application
An Application with example can be downloaded at the BIAPP Repository:
- DesignStudioBiAppRepository/SDK_COLLECTION at master · KarolKalisz/DesignStudioBiAppRepository · GitHub
- or as ZIP: Release Adding Example for Collection · KarolKalisz/DesignStudioBiAppRepository · GitHub
Releases
Source Code & Licensing
This component is for free use. It is under the Open Source Apache Version 2.0 License.
Important Maintenance Notice (... as I am SAP Employee)
The component is NOT delivered under SAP maintenance license.
You cannot claim any Support on this component from SAP!
The components are created on "private" basis - you can use them as is. I can modify, correct or improve - but there is no obligation to do it. Of course I will try to correct bugs or improve the component as long I can.
Have Fun!
for other components see: Karol's SDK Components