Is it possible to list only distinct values in combobox? Here is code section: <combobox name="cmb_korpus" column="KORPUS" datasource="BAZA_OFIS1" valuecolumn="KORPUS" listdatasource="BAZA_OFIS1" displaynulloption="Y"/>

How to make KORPUS set to list exactly distinct values?

asked 14 Dec '14, 09:06

Emil's gravatar image

accept rate: 0%

Hi Emil,

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.

procedure executeQuery is

procedure executeQueryDistinct is
  v_defaultquery_tx varchar2(4000); 
  v_distinctquery_tx varchar2(4000);
  v_defaultquery_tx := api_datasource.getDefaultQuery('BAZA_OFIS1');
  v_distinctquery_tx := 'select distinct t1.korpus from (' || v_defaultquery_tx || ') t1 ';
  api_datasource.setdefaultquery('BAZA_OFIS1', v_distinctquery_tx);
  api_datasource.setdefaultquery('BAZA_OFIS1', v_defaultquery_tx);



answered 20 Dec '14, 04:08

Serdar's gravatar image

Serdar ♦♦
accept rate: 14%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: 14 Dec '14, 09:06

Seen: 708 times

Last updated: 20 Dec '14, 04:08

© Copyright Gerger 2017