Re: Dynamic Lists in Forms4.5

From: Neville Sweet <sweet.neville.nj_at_bhp.com.au.no_junk_today_thanks>
Date: 1998/03/09
Message-ID: <01bd4b0e$f4078200$45f11286_at_itwol-pc3963.itwol.bhp.com.au>#1/1


Nilesh,

Is city_id numeric? Both the list label and list value must be char, ie. 'select to_char(city_id), city_name from cities'.

Then again, what do you want people to see? Since they see the label, the list will show 1, 2, 3 etc.
I would suggest what you need is:
'select city_name, to_char(city_id) from cities'. By the way, since you have already obtained group_id in Create_Group_From_Query, why not subsequently use it instead of repeating 'city_names'? Using the Id improves performance.

You might also consider an LOV instead of a List if there are a large number of cities.

nilesh_at_cheerful.com wrote in article <6dnvfm$kqf$1_at_nnrp1.dejanews.com>...
> hello,
>
> I am trying to populate a list at runtime.
> This is what the table is
>
> SQL> select * from cities;
>
> CITY_ID CITY_NAME
> --------- ------------------------------
> 1 BOMBAY
> 2 PUNE
> 3 DUBAI
> 4 BANGALORE
> 5 JODHPUR
>
> In the form I have a emp_master_clock corresponding to the
 emp_master_table
> in the database.
>
> There is a list box which give the city values and which I want to
 populate.
> I have written a when-new-bock-instance trigger:
>
> DECLARE
> group_id RecordGroup:= Find_group('city_names');
> it_id Item := Find_Item('city_list');
> status NUMBER;
> sqlstmt varhcar2(200);
>
> BEGIN
>
> sqlstmt := 'Select city_id id, city_name value from cities';
>
> if (Id_Null(group_id)) then
> group_id := Create_Group_From_Query('city_names',sqlstmt);
> status := Populate_Group('city_names');
> Populate_List(it_id,'city_names');
> else
> Populate_List(it_id,'city_names');
> end if;
>
> END;
>
> I cant populate the group. Error FRM 41072 Cant Populate city_names
> And this is what help says :
>
> FRM-41072: Cannot create Group <record group name>.
> Cause: Caused by one of the following
> 1. Duplicate column names in SQL statement.
> 2. Invalid record group name.
> 3. Query is invalid.
etc. Received on Mon Mar 09 1998 - 00:00:00 CET

Original text of this message