Home » Developer & Programmer » Forms » poplute list
poplute list [message #156282] Tue, 24 January 2006 06:38 Go to next message
awan
Messages: 9
Registered: September 2005
Location: Riyadh
Junior Member
Hi,
I v populated list in country_list from the other table which v 2 columns conuntry_code number(10) and country_name varchar2(25)

the code is

DECLARE
RG_NAME VARCHAR2(40) :='COUNTRY_LIST';
GROUPID RECORDGROUP;
STATUS NUMBER;
BEGIN
GROUPID := CREATE_GROUP_FROM_QUERY(RG_NAME,'SELECT COUNTRY_NAME,COUNTRY_NAME FROM COUNTRY');
STATUS := POPULATE_GROUP(GROUPID);
POPULATE_LIST('COUNTRY_LIST',GROUPID);
END;


I need the solution to save country_code in datebase instead of conuntry_name...... and country_name should display in list ....if I modify query like SELECT COUNTRY_NAME,COUNTRY_ID FROM COUNTRY....it dosnot works

plz help me abt it.....
I will be very thankfull to u

Re: poplute list [message #156341 is a reply to message #156282] Tue, 24 January 2006 16:07 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Have a non-database field country_name in your record and populate it in the Post-Query trigger.
In your record group make the Country_ID your first field and in the LOV display give it a length of 0 (zero) so that the ID does not appear and assign it to the ID field in your record. Assign the second field (country_name) to the country_name in your block. Attach this LOV to your non-database country_name field and when the user populates a new record or changes an existing value bothy the database ID and non-database name will be updated.

By the way, you can create this record group in the Form builder, you don't have to do it in code.

Search this forum for 'record group'.

David
Re: poplute list [message #156870 is a reply to message #156341] Sun, 29 January 2006 01:03 Go to previous messageGo to next message
awan
Messages: 9
Registered: September 2005
Location: Riyadh
Junior Member
Hi Mr.David,
I think I couldnot explain well....let me explain it again.....I made a List Item (Combo box)named 'CPI_ISSUE_COUNTRY' at my form ...I want to populate list from other table "country"(which v 2 colums (1)country_id (2)country_name) in this combo box ..I v populated the list in combo box by creating record group with the help of this code:

Trigger : WHEN-NEW-FORM-INSTANCE (Form Level)

DECLARE
RG_NAME VARCHAR2(40) :='CPI_ISSUE_COUNTRY';
GROUPID RECORDGROUP;
STATUS NUMBER;
BEGIN
GROUPID := CREATE_GROUP_FROM_QUERY(RG_NAME,'SELECT COUNTRY_NAME,COUNTRY_NAME FROM COUNTRY');
STATUS := POPULATE_GROUP(GROUPID);
POPULATE_LIST('CPI_ISSUE_COUNTRY',GROUPID);
END;

The scenario is that I want to save country_id in database instead of country_name ...but country name should display in the combo box

the second Scenario is:

on the same form I v made one other combo box named 'CPI_CITY_NAME' in which cities r populating in the same way as coutries are populating in the 'CPI_ISSUE_COUNTRY'.....Wat the end user required ....when he select USA from the first combo box 'CPI_ISSUE_COUNTRY' only the USA cities should display in the cities combo box 'CPI_CITY_NAME' and if he select other country ,then the cities of that country should display....


I really appritiate u ...that u experts r solving the problems of peoples....

Thanks
Re: poplute list [message #156903 is a reply to message #156870] Sun, 29 January 2006 19:28 Go to previous message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Then add the Country Field to the 'select' statement used in the second (city) field. As I said, search this forum for 'record group' and try 'record group country'. This question has been answered previously.

David
Previous Topic: Form Error
Next Topic: CONDITIONS
Goto Forum:
  


Current Time: Fri Sep 20 05:29:34 CDT 2024