The first thing and the most common way to achieve getting distinct values is modifiying the SQL query of the datasource in design time by using Formspider IDE. However, there's a way in Formspider that allows you to modify the SQL query in runtime.

To make this change you should set queryOnInitialize=false of you datasource, BAZA_OFIS1 by using Formspider IDE datasource dialog. Then you need to execute the dataSource manually whenever you need. To change the query in runtime you will use api_datasource.getDefaultQuery and api_datasource.setDefaultQuery APIs. Please keep in mind that the new query you prepare must have the same column names in the exact same order as the old one.

As an example, please take a look at the following example procedures. You should choose the suitable one before you execute the dataSource.