Skip to content

How to obtain distinct values from a SmartObject

Konstantin edited this page Dec 4, 2017 · 3 revisions

Let's imagine, you need to populate a Listing control (DropDown or anything else) with distinct values from a certain SMO. You can easily achieve this with the help of the current ServiceBroker. For the demo purposes I will be using a SmartObject with the following values, where Name property will be used as a DisplayName and Value - as a value for a Listing control:

  1. Configure a new ServiceObject for your ServiceInstance by adding the following json. For the current tutorial we can assume, that a Value will be of Number type and the DisplayName will be Text.
[  
   {  
      "SoName":"ListingControlValues",
      "Properties":[  
         {  
            "Name":"Value",
            "Type":"Number"
         },
         {  
            "Name":"DisplayName",
            "Type":"Text"
         }
      ]
   }
]

After doing this, you will see the following structure of your Service Instance:

  1. Create a SmartObject from the generated ServiceInstance
  2. Add a DropDown control onto your view and map it to the newly created SmartObject:
  3. Add the following query into AdoQuery field, which is used as an input parameter to populate the Listing control:

SELECT DISTINCT [Value] AS [Value], [Name] AS [DisplayName] FROM Test_Smo_ValuesForDropDown 5. Open your view and check the values in the dropdown control:

Clone this wiki locally