Home » Developer & Programmer » Forms » default_where
default_where [message #160998] Wed, 01 March 2006 06:10 Go to next message
orafan2003
Messages: 122
Registered: February 2006
Senior Member
Hi,
I have a PSKILLS block with the following colums.
skill_type_id skill_type
     1             Oracle
     2             Java
     3             All
I also have a CSKILLS table
  skill       skill_type_id
    SQL             1
    PLSQL           1
    J2EE            2
    Servlet         2
The main idea is as follows:
The column skill_type in PSKILLS is a list item.When Oracle is selected, SQL and PLSQL in the CSKILLS should be highlighted. Similarly for Java. when All is selected all 4 options should be shown.
I wrote a when_list_changed trigger in the skill_type of PSKILLS table.
when_list_changed
go_block('cskills');
execute_query;
next in the pre_block of CSKILLS, I wrote the following code:
set_block_property('cskills', default_where, 'cskills.skill_type_id = :pskills.skill_type_id');
I was not sure of this code so I wrote another code
set_block_property('skill', default_where, 'skill in (select skill_type_id from pskills where skill_type=''Oracle'')');
now when I select one skill(example Oracle) from PSKILLS, SQL and PLSQL should be shown ,,, but all the skills are shown.
How can I succeed in this task?
Also I should be able to rate the person in his skills...like excellent, good and poor.
For that I created a radio group and sets of radio buttons.
Now my form should look as follows:
sql    .excellent  .good  .poor
plsql  .excellent  .good  .poor
When I created radio buttons, only the first row is getting activated. other rows are inactive.
Please guide me with suggestions.
Thank you

Upd-mod: Next time please use standard English punctuation (spaces after commas and periods), use 'code' tags, and don't underline text that contains underscores!

[Updated on: Thu, 02 March 2006 01:01] by Moderator

Report message to a moderator

Re: default_where [message #161105 is a reply to message #160998] Thu, 02 March 2006 01:00 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
This question is an entension of http://www.orafaq.com/forum/m/160139/67467/#msg_160139 and should have been added to that thread. However, you are asking other stuff so here goes.

Okay the pre-block for 'CSKILLS' is unnecessary as the 'relations' should be handling the inter-block linkage.

set_block_property('skill',default_where,'skill in (select skill_type_id from pskills where skill_type=''Oracle'')');
should be
set_block_property('cskills',default_where,'skill_type_id in (select skill_type_id from pskills where skill_type=''Oracle'')');

I'll answer the rest tomorrow.

David

[Updated on: Thu, 02 March 2006 01:02]

Report message to a moderator

Re: default_where [message #161121 is a reply to message #161105] Thu, 02 March 2006 02:19 Go to previous messageGo to next message
orafan2003
Messages: 122
Registered: February 2006
Senior Member
Sir,
Thank you so much for your prompt reply.
Re: default_where [message #161521 is a reply to message #161121] Sun, 05 March 2006 22:55 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Is this working for you now?

David
Re: default_where [message #161541 is a reply to message #161521] Mon, 06 March 2006 00:13 Go to previous messageGo to next message
orafan2003
Messages: 122
Registered: February 2006
Senior Member
Hi,
It is working for me .
Thanks a lot.
Re: default_where [message #162248 is a reply to message #161105] Thu, 09 March 2006 06:36 Go to previous messageGo to next message
orafan2003
Messages: 122
Registered: February 2006
Senior Member
Hi,
In the same form, when I click on submit, I should populate my transaction table. But clicking on submit is going to Pskills table. How should I write write my code so that I can populate the transaction table?
Thanks & Regards
Re: default_where [message #162351 is a reply to message #162248] Thu, 09 March 2006 18:09 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
On which block does 'submit' reside? make sure you have a go_block('pskills') command in your triggered code.

David
Re: default_where [message #162418 is a reply to message #162351] Fri, 10 March 2006 02:35 Go to previous messageGo to next message
orafan2003
Messages: 122
Registered: February 2006
Senior Member
Hi,
The 'SUBMIT' button is in the transaction block ie Entries.
In 'SUBMIT' I wrote commit_form in When_button_pressed. But when I click on 'SUBMIT' , I get a message in the console,
FRM-40101:No changes to save.
What can be done now?

In my entry form, I am selecting the Empname, his primary skills, then his childskills are seen. Then I rate him . I click on the SUBMIT button then. This SUBMIT button should populate in the Entries table which has the following columns. Empid, Skillid and ratingid.
The values which I am entering in my entry form are varchar2.
Then when I click on SUBMIT, how can numbers be populated?
For that I wrote one code.
declare
	eid number;
	sid number;
	rid number;
	emp_id number;
	rating_id number;
	rating_id number;
	emp_name varchar2(15);	
	
begin
	select emp_id,skill_id,rating_id into eid,sid,rid
	from entries where 
        emp_id=(select emp_id from empl where emp_name=':control.employee') and
      skill_id=(select skill_id from cskills where skill=':cskills.skill') and
     rating_id=(select rating_id from ratings where rating=':cskills.rate');

	insert into entries values(eid,sid,rid);
	commit_form;
	end;
Now when I click on SUBMIT, it says, FRM-40735 : when -button-pressed trigger raised unhandled exception-ORA 01403

What can I do now??

[Updated on: Mon, 13 March 2006 00:34] by Moderator

Report message to a moderator

Re: default_where [message #162420 is a reply to message #162418] Fri, 10 March 2006 02:43 Go to previous messageGo to next message
orafan2003
Messages: 122
Registered: February 2006
Senior Member
I added this exception to my code in when_button_pressed:

exception
when no_data_found then
message('Invalid');
message('Invalid');
raise form_trigger_failure;

What can I do now to save the changes that I made in my entries table?
Re: default_where [message #162677 is a reply to message #162420] Mon, 13 March 2006 00:42 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Please consider making your 'entries' tables subordinate to your other table. Do not write your own 'insert' statements. Let Oracle Forms do the work for you. All you have to do isa define the 'relations' between the master and detail blocks. Populate the master key in the When-Create-Record of the master block and use the 'Copy Value from Item' property of the detail item to populate this value in the detail record.

Put the emp_id, skill_id, and rating_id selection in the 'where clause' property of the detail block.

Please review the Master/Detail demonstration application.

Please discuss this with your fellow students. Develop your code in a cooperative environment because you will be working in one.

David
Re: default_where [message #162971 is a reply to message #162677] Tue, 14 March 2006 06:44 Go to previous messageGo to next message
orafan2003
Messages: 122
Registered: February 2006
Senior Member
Sir,
I tried out creating master-detail but the expected result is not coming.
In my entries form I enter the Employee name, skilltype(Oracle, Java, All) , skill(SQL, PLSQL, J2EE, Servlet) and ratings(excellent, good and poor) .
Now when I click on the 'submit' button I should populate the Entries table.
Entries table has Emp_id, Skill_id, Rating_id.
So I need to convert the empname, skill and rating to respective id's.
The code which I wrote is as follows.
declare
eid number;
sid number;
rid number;

begin
eid:=(select emp_id from empl where empname=':control.employee');
sid:=(select skill_id from cskills where skill=':cskills.skill');
rid:=(select rating_id from ratings where rating=':cskills.rate');
insert into entries values(eid,sid,rid);
end;

Where should I write this code?? In which trigger of entries block?? This code is giving me errors too.
In the Submit button, I wrote

go_block('entries');
commit_form;
Kindly guide me.
Re: default_where [message #163078 is a reply to message #162971] Tue, 14 March 2006 21:05 Go to previous message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
First, remove the quote from each end of the item name.

Second, use the Forms name for the destination item.

Populate 'Entries.emp_id' in a When-Create-Record trigger using "select emp_id into :Entries.eid from empl where empname=:control.employee;".

Put the other two 'select' statements in the When-Validate-Item trigger of their 'parent' field. That is, for the ':cskills.skill' item have a WVI trigger containing "select skill_id into :cskils.sid from cskills where skill=:cskills.skill;".

David

Previous Topic: i need Reports Faq's
Next Topic: report doesnot wotk from form please help & report doesnot wotk from form please help1 (merged)
Goto Forum:
  


Current Time: Fri Sep 20 07:34:37 CDT 2024