Home » Developer & Programmer » Forms » execute query run fine with numeric data not give result on string data
execute query run fine with numeric data not give result on string data [message #161600] Mon, 06 March 2006 04:17 Go to next message
mfa786
Messages: 210
Registered: February 2006
Location: karachi
Senior Member
Hi master
Sir
I have one form and three option button

1-jv journal voucher
2-bp bank payment
3-cp cash payment

my requirement is when my user select any one option then trigger fire and fetches the related record such as

select * from vouchertable where vtype =’jv’

please give me idea and sample where I put my query or which event I use

thanking you
Aamir
Desire

execute query on opetion buttion as per user desire
form opening query /execute query



year selection

set_block_property('your_blk',default_where,'year = :ctrl.year');
go_block('your_blk');
execute_query;


Ok,
take a block based on the EMP table. When you run the form from the command line, you give a empno, and forms will look up the other data of this employee. In forms we have a base table block on EMP. We create a parameter (P_EMPNO). In the property palette of the block, you set the where clause to "empno = :PARAMETER.P_EMPNO" (without the quotes). Then you force Forms to execute the query immediately on startup. This is done in the WHEN-NEW-FORM-INSTANCE trigger. There, you put something like:
EXECUTE_QUERY
DO_KEY(KEY-EXEQRY)
to invoke the query.

From the command line you issue the following:
ifrun60 test.fmx scott/tiger@my_sid p_empno=7369
Of course, the name of the executable depends on your version.


Sorry for my late reply, but it is possible. You just enter something like:
IF :PARAMETER.P_myparameter IS NOT NULL THEN
EXECUTE_QUERY;
ELSE
EXIT_FORM; -- when no data provided exit the form.
-- Of course, you can do sth else here, like resetting the Where-clause of the block so that is freely queryable.
END IF;
in the WHEN-NEW-FORM-INSTANCE.

WHEN_NEW_FORM_INSTANCE
enter_query;
:datablock.field := :global.parameter;
execute_query;


I have 2 modules: Module1 (based on DEPT) and Module2 (based on EMP). If I start Module1 and query a department I can push a button which calls Module2 to display all employees in the given department. In order to achieve this I have made the following modifications in Module1 (calling form): Added a push-button with the following code in the WHEN-BUTTON-PRESSED trigger:
----------------------------------------------------------------------
DECLARE
pl_id PARAMLIST;
theformname VARCHAR2(20);
BEGIN
theformname := 'Module2';


pl_id := GET_PARAMETER_LIST('tempdata');
IF NOT ID_NULL(pl_id) THEN
Destroy_Parameter_List('tempdata');
END IF;
pl_id := CREATE_PARAMETER_LIST('tempdata');
Add_Parameter(pl_id, 'P_DEPTNO', TEXT_PARAMETER, :DEPT.DEPTNO);

CALL_FORM(theformname, hide, no_replace, query_only, pl_id);
END;


Following is the sequence:
Assuming that you are already logged on.
Pre-logon
On-logon
Post-logon
Pre-form
When-New-Form-instance
Pre-block
When-new-block-instance
Pre-record
When-new-record-instance
Pre-Text-item
When-new-item-instance


hi,insert time
pre-insert
on-insert
post-insert

IF NOT company_cur%ISOPEN
THEN
OPEN company_cur;
END IF;



Frm-40105 : unable to resolve reference to item 20.

execute query not give any result
hi master

sir when i put this code on when_button_press then give this error


go_block('emp');
enter_query;
:emp.deptno := 10;
execute_query;

error

Frm-40105 : unable to resolve reference to item 20.

sir please give me idea

Thanking you



U can use

go_block('EMP');
set_block_property('EMP',DEFAULT_WHERE,'empno=10');
/* Instead of empno=10 u can also use any parameter or item value which is known at the run time
set_block_property('EMP',DEFAULT_WHERE,'empno=:parameter.p1');*/
execute_query;

The block will show all the records in emp where deptno = 10
Hi master
Sir I use under blow code for execute query
sir when I use numeric data then run fine but when I use character data then not give any result

with numeric run fine

DECLARE
DD VARCHAR2(15);

BEGIN
DD:=10;
set_block_property('emp', default_where, 'where DEPTNO='||DD);
go_block('emp');
execute_query;
set_block_property('emp', default_where, '');
END;


With character not give any result
DECLARE
DD VARCHAR2(15);

BEGIN
DD:='SALESMAN';
set_block_property('emp', default_where, 'where RTRIM(EMPNO)='||DD);
go_block('emp');
execute_query;
set_block_property('emp', default_where, '');
END;

Please give me any idea
Re: execute query run fine with numeric data not give result on string data [message #161725 is a reply to message #161600] Mon, 06 March 2006 20:58 Go to previous message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Is there anything in this post that you haven't put into one of the other 5 threads that I have already merged into http://www.orafaq.com/forum/t/59938/67467/?

David

[Updated on: Mon, 06 March 2006 20:59]

Report message to a moderator

Previous Topic: help me plz
Next Topic: FRM-40735
Goto Forum:
  


Current Time: Fri Sep 20 04:55:13 CDT 2024