Home » Developer & Programmer » Forms » Calling a field from list items...Please help me!!
Calling a field from list items...Please help me!! [message #167981] Tue, 18 April 2006 04:19 Go to next message
Rose_250
Messages: 17
Registered: April 2006
Junior Member
hi every body,

I face a problem in calling a field from list items...
what shall I do?
I have faculty table which contains facultycode and facultyname,
I made the facultycode as list Item, and facultyname as text item, but the problem is that when I select the facultycode, the facultyname doen't appear automatically..

I used LOV in order to range facultycode in a list:
First I create a faculty list in DB which only contains facultycode :
SQL> create table faculty_list
2 ( facultycode varchar2(2));

Table created.

SQL> insert into faculty_list values(1);

SQL> insert into faculty_list values(2);

SQL> insert into faculty_list values(3);

SQL> insert into faculty_list values(4);

Then I create LOV by using this Query:
select facultycode into :faculty.facultycode from faculty order by facultycode;

Then
I create a Button and i wrote this code:
declare
return_lov boolean;
begin
return_lov :=show_lov('faculty_lov');
end;


Note: you can see the attached picture


I i used a trigger KEY-NEXT-ITEM for facultycode with the following code:
if :system.mode = 'Enter-Query' then
execute_query;
end if;

on the other hands, i used a trigger WHEN-VALIDATE-ITEM for facultyname with the following code:
BEGIN
select facultyname
into :faculty.facultyname
from faculty
where facultycode=:faculty.facultycode;
END;

Can any body help me to solve this problem? Urgent Please
  • Attachment: LOVcode.bmp
    (Size: 1.37MB, Downloaded 926 times)
Re: Calling a field from list items...Please help me!! [message #168082 is a reply to message #167981] Tue, 18 April 2006 12:49 Go to previous messageGo to next message
Rose_250
Messages: 17
Registered: April 2006
Junior Member
Hi Experts,

Can you help me to solve this problem?

Regards

Re: Calling a field from list items...Please help me!! [message #168110 is a reply to message #167981] Tue, 18 April 2006 20:04 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Okay ... lose the 'faculty_list' table. You will do better to have two columns in your record_group and LOV. To follow your logic use the following
select   facultycode,
         facultyname
    from faculty
order by facultycode;
to populate your record group. In your LOV have the 'facultycode' come back to ':faculty.facultycode' and 'facultyname' to ':faculty.facultyname'.

PERSONALLY I see no reason to expose your user to the 'facultycode'. For maintaining the code list you will need both code and faculty, but on the user page you only need the faculty and their LOV should be in their natural name alphabetic order, not some arbitrary code order.

In your button trigger have a 'go_item' to the field you are going to populate, then should the LOV.

David
Re: Calling a field from list items...Please help me!! [message #168446 is a reply to message #168110] Thu, 20 April 2006 08:17 Go to previous messageGo to next message
Rose_250
Messages: 17
Registered: April 2006
Junior Member
Hi Mr. David
Thank you very much for your guidance..

I'll try to do this on Saturday because I haven't a university today and tomorrow..

Actually, I agree with you that the user should select the facultyname which should be assigned to facultycode/facultyID.
Thats what I intend to make in the form that I will use it to generate a report for me..

But I am using another form just for inserting, deleting, updating, & searching of any faculty code and its name. What did you think Sir?

I'll try to make two cloumns in LOV using go_item trigger, and I'll tell you what will happen if you don't mind.

Thanks a gain
Regards

Rose

Re: Calling a field from list items...Please help me!! [message #168531 is a reply to message #168446] Thu, 20 April 2006 20:33 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Yes ... there are two types of Forms, one of which is used to maintain the list of facilities (insert, update, delete) and which doesn't need the LOV, and the other type of forms, which are user forms, where you do use the LOV, show the facultyname but use the facultycode in the database record.

David
Re: Calling a field from list items...Please help me!! [message #168929 is a reply to message #168531] Mon, 24 April 2006 04:18 Go to previous messageGo to next message
ksmbabu
Messages: 9
Registered: April 2006
Location: MALAYSIA
Junior Member
yes you can use create_group_from_query function to populate the record group progrmmatically. put the code in when-new-form-instance trigger. under the textfiled of LOV u create a trigger

key-listval
begin
list_values;
end;

where r u from. can we be friends
Re: Calling a field from list items...Please help me!! [message #169023 is a reply to message #168929] Mon, 24 April 2006 13:44 Go to previous messageGo to next message
Rose_250
Messages: 17
Registered: April 2006
Junior Member
Hi Mr.ksmbabu,

Thanks for your kindly reply, of course I'll try to do this solution also; because until know I didn't succeed in doing it..
and of course we can be friends Razz

Re: Calling a field from list items...Please help me!! [message #169159 is a reply to message #169023] Tue, 25 April 2006 06:58 Go to previous message
ksmbabu
Messages: 9
Registered: April 2006
Location: MALAYSIA
Junior Member
Thanks for your reply. where r u from. keep in touch with me
Previous Topic: export not working with template.fmb
Next Topic: Displaying a single block item across the form repeatedly
Goto Forum:
  


Current Time: Fri Sep 20 07:33:32 CDT 2024