Populating Drop Down Menus

#1

I see how to populate a dropdown menu with results from a fetch() call (see assignee lists, facility lists, region lists, etc.), but this only seems to be applicable when working with a drop down list that will be populated by instances of types (Users, Facilities, Regions, etc.)

Is there a way to populate a dropdown list with either a deduplicated return from a fetch() call, or the results of a grouped evaluate() call?

Example, there is no Manufacturer Type in this environment, because there’s no current need to store any other data related to the manufacturer, however, I want users to be able to filter assets based on who manufactured them through a dropdown menu:

c3Grid(Asset.evaluate({projection: “manufacturer”, group: “manufacturer”})) [will need a different response selector]

c3Grid(Asset.fetch({include: “manufacturer”})) . [deduplicated somehow]

Example where this could replace a hard-coded list:

                            "id": "manufacturer",
                            "component": "ControlGroup",
                            "options": {
                                "intersects": {
                                    "value": true
                                }
                            },
                            "label": "{~label.translation~}",
                            "dependencies": {
                                "assetType": "Electric Meter"
                            },
                            "items": [
                                {
                                    "id": "manufacturer",
                                    "component": "field.Select",
                                    "ignorePageRecord": true,
                                    "name": "meter.manufacturer",
                                    "valueField": "text",
                                    "multiple": true,
                                    "opts": [
                                        { "id": "opt1", "text": "ACTARIS-SCHLUMBRGR-SPRAGUE" },
                                        { "id": "opt2", "text": "AMERICAN" },
                                        { "id": "opt3", "text": "ASTRA" },
                                        { "id": "opt4", "text": "DANIEL" },
                                        { "id": "opt5", "text": "DRESSER-ROOTS" },
                                        { "id": "opt6", "text": "ELECTRO-INDUCTRIES" },
                                        { "id": "opt7", "text": "ELSTER-ABB-WESTINGHOUSE" },
                                        { "id": "opt8", "text": "EQUITABLE" },
                                        { "id": "opt9", "text": "GENERAL ELECTRIC" },
                                        { "id": "opt10", "text": "ITRON-SCHLUMBERGER-SANGAMO" },
                                        { "id": "opt11", "text": "LAMBERT" },
                                        { "id": "opt12", "text": "LANDIS+GYR-DUNCAN" },
                                        { "id": "opt13", "text": "LANDIS+GYR-SIEMENS-PSI" },
                                        { "id": "opt14", "text": "MARYLAND" },
                                        { "id": "opt15", "text": "NASG" },
                                        { "id": "opt16", "text": "SCHWEITZER ENGIN LAB INC" },
                                        { "id": "opt17", "text": "SENSUS" },
                                        { "id": "opt18", "text": "SENSUS-INVNSYS-EQMTR-RKWL" },
                                        { "id": "opt19", "text": "SUPERIOR" },
                                        { "id": "opt20", "text": "WESTINGHOUSE" }
                                    ]
                                }
                            ]
                        },```
#2

Credit to Zicheng:

You can create a DataSource for Manufacturers like this, note the response selector, and try this in static console to see the EvaluateResponse:
“c3type”: “TypeName”,
“c3function”: “evaluate”,
“c3arguments”: {
“spec”: {
“projection”: “unique(manufacturer)”
}
},
“responseSelector”: “tuples.cells”

Then format the Filter Drop Down Box by adding the valueField and displayFields on your field.Select and setting them equal to ‘str’ or ‘value’ , based on the result of your call in console.