Home » Developer & Programmer » Forms » Unable to fetch data using control-blocks (Oracle 10.1.2.0.2, windows server)
icon7.gif  Unable to fetch data using control-blocks [message #487262] Fri, 24 December 2010 07:27 Go to next message
tramc1234
Messages: 3
Registered: December 2010
Location: india
Junior Member
Hi,

I have created two non base table text items(from date, to date) and if values are not entered from front end i.e. null then hadrcoded in pre_query trigger to default values.But even i enter values dynamically from front end and when ever i press fetch button ,it is taking default values i.e. it is not accepting values what i have entered.

any one please help me.

Thanks and Regards
Ram
Re: Unable to fetch data using control-blocks [message #487315 is a reply to message #487262] Fri, 24 December 2010 15:15 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
What code have you put where to make the query use the values from the control block?
It's very hard to debug code we know nothing about.
Re: Unable to fetch data using control-blocks [message #487372 is a reply to message #487315] Sun, 26 December 2010 07:03 Go to previous messageGo to next message
tramc1234
Messages: 3
Registered: December 2010
Location: india
Junior Member
I have Hardcoded the from date(system date-present month-last year) and to date(system date-present month-present year) values in PRE_QUERY trigger.when i was pressed the fetch button without giving any values to fromdate and todate,it is giving the records in between default duration(system date-present month-last year , system date-present month-present year).My problem is when i was entered values to fromdate and todate dynamically from frontend and it is giving the records in between default duration instead of specified duration.

Re: Unable to fetch data using control-blocks [message #487400 is a reply to message #487372] Sun, 26 December 2010 12:25 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
It means that you did it wrong. In order to get desired results, you'll need to fix it.

We still can't debug code we don't see (PRE-QUERY trigger might be interesting, as well as WHEN-BUTTON-PRESSED behind the "fetch" button). Could you post the code?

[Updated on: Sun, 26 December 2010 12:26]

Report message to a moderator

Re: Unable to fetch data using control-blocks [message #487462 is a reply to message #487400] Mon, 27 December 2010 07:47 Go to previous messageGo to next message
tramc1234
Messages: 3
Registered: December 2010
Location: india
Junior Member
Hi,

first of all thanks for your feedback.

please find the code below,which has been hard coded in PRE_QUERY.


:GLOBAL.DFROMDT := NULL;
   :GLOBAL.DTODT := NULL;
  

IF :HEADER_BLOCK.NBTFROMDT is NULL THEN  
  	
    SELECT TO_DATE('10'||'/'||TO_CHAR(ADD_MONTHS(SYSDATE,-1),'MM')||'/'||
     TO_CHAR(ADD_MONTHS(SYSDATE,-12),'YYYY'),'DD/MM/YYYY') 
    INTO :HEADER_BLOCK.NBTFROMDT FROM SYS.DUAL ;
END IF;
   
IF :HEADER_BLOCK.NBTTODT IS  NULL THEN 		
 
	SELECT SYSDATE INTO :HEADER_BLOCK.NBTTODT
  	FROM SYS.DUAL;
END IF;


	

IF :HEADER_BLOCK.NBTFROMDT IS NOT NULL 
   OR :HEADER_BLOCK.NBTTODT IS NOT NULL THEN

    :GLOBAL.DFROMDT := :HEADER_BLOCK.NBTFROMDT;
    :GLOBAL.DTODT := :HEADER_BLOCK.NBTTODT;

END IF;

	
IF :DETAIL_BLOCK.nbtFjdDrCrInd IS NOT NULL THEN
   	svWhere_String := 'WHERE VCHR_DT BETWEEN '''||nvl(:GLOBAL.DFROMDT,TO_DATE(:GLOBAL.DFROMDT,'DD/MM/YYYY'))||''' AND '||
                         ''''||NVL(:GLOBAL.DTODT,TO_DATE(SYSDATE,'DD/MM/YYYY'))||''')';
	  Set_Block_Property('DETAIL_BLOCK',DEFAULT_WHERE,svWhere_String);
  
  ELSE
  	
  	Set_Block_Property('DETAIL_BLOCK',DEFAULT_WHERE,' ');
   
END IF;






WHEN-BUTTON-PRESSED behind the "fetch" has EXECUTE_QUERY.



CM: added [code] tags, please do so yourself next time, see the orafaq forum guide if you're not sure how.

[Updated on: Mon, 27 December 2010 13:38] by Moderator

Report message to a moderator

Re: Unable to fetch data using control-blocks [message #487467 is a reply to message #487462] Mon, 27 December 2010 13:44 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
I assume this pre-query is on the detail block.
Some points:
1) The select from dual's are unecessary - you can assign those values without a select.
2) This;
IF :HEADER_BLOCK.NBTFROMDT IS NOT NULL 
   OR :HEADER_BLOCK.NBTTODT IS NOT NULL THEN
Is pointless, since you've made sure it must always be true, there really is no point checking.
3) The final If makes no sense to me. Why would you be a checking if an item in the detail block is populated in the pre-query trigger?
Re: Unable to fetch data using control-blocks [message #487468 is a reply to message #487467] Mon, 27 December 2010 13:45 Go to previous message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
4) What is the point of this:
nvl(:GLOBAL.DFROMDT,TO_DATE(:GLOBAL.DFROMDT,'DD/MM/YYYY'))
Previous Topic: ActiveX control is blank at run-time
Next Topic: i need call report from forms 11g
Goto Forum:
  


Current Time: Fri Sep 20 00:45:29 CDT 2024