Home » Developer & Programmer » Forms » DFAULT_WHERE issues (merged again)
DFAULT_WHERE issues (merged again) [message #180615] Tue, 04 July 2006 07:41 Go to next message
mfa786
Messages: 210
Registered: February 2006
Location: karachi
Senior Member
my promlem is how use between funciton in form opening where clasee for date

i use this code but not give me result

such as
:global.newparty :=0;	
declare
	vtypev varchar2(15);
BEGIN
vtypev :='BPV';
set_block_property('voumaster', default_where, 'where vtype='||''''||vtypev
                   ||''' and entdate between '01-07-2005 and '30-06-2006');
go_block('voumaster');
execute_query;
set_block_property('voumaster', default_where, '');
END;

please send me idea how i get data only given date

thank

aamir

[Updated on: Tue, 04 July 2006 21:35] by Moderator

Report message to a moderator

DFAULT_WHERE issues (merged) [message #180624 is a reply to message #180615] Tue, 04 July 2006 08:12 Go to previous messageGo to next message
mfa786
Messages: 210
Registered: February 2006
Location: karachi
Senior Member

sir i use this code for DEFAULT_WHERE but not system give me result
:global.newparty :=0;
declare
vtypev varchar2(15);
BEGIN

:yearid :=1;
:ysdate :=sysdate;
:yedate :=sysdate;
:ystatus := 'T';
vtypev :='BPV';
SET_BLOCK_PROPERTY('voumaster',DEFAULT_WHERE,'where vtype='||''''||vtypev||''' and entdate BETWEEN '||:ysdate|| 'AND '||
:yedate||'');
go_block('voumaster');
execute_query;
set_block_property('voumaster', default_where, '');
END;

Re: DEFAULT_WHERE problem [message #180632 is a reply to message #180624] Tue, 04 July 2006 08:32 Go to previous messageGo to next message
saadatahmad
Messages: 452
Registered: March 2005
Location: Germany/Paderborn
Senior Member

hi,
If I have to write a where clause at run time for the emp form according to your requirements, I'll write like this.

SET_BLOCK_PROPERTY('EMP', DEFAULT_WHERE, 'deptno = 30 AND hiredate BETWEEN '||''''||'17-DEC-1980'||''''||' AND '||''''||'01-MAR-1981'||'''');


BTW: If you get an error in your where clause at runtime, you can always find what is wrong with the clause by Help-->Display Error

regards,
Saadat Ahmad

[Updated on: Tue, 04 July 2006 08:32]

Report message to a moderator

Re: DEFAULT_WHERE problem [message #180648 is a reply to message #180632] Tue, 04 July 2006 09:35 Go to previous messageGo to next message
mfa786
Messages: 210
Registered: February 2006
Location: karachi
Senior Member
thank for your reply
sir i have date in global variable
how i put variable in your code
such as deptono , date1 and date2 are global variable

SET_BLOCK_PROPERTY('EMP', DEFAULT_WHERE, 'deptno = :deptno AND hiredate BETWEEN '||''''||':date1'||''''||' AND '||''''||'date2'||'''');

try this but not work DEFAULT_WHERE, 'where vtype='||''''||vtypev||'''' AND 'entdate='||''''||o_date [message #180652 is a reply to message #180624] Tue, 04 July 2006 10:07 Go to previous messageGo to next message
mfa786
Messages: 210
Registered: February 2006
Location: karachi
Senior Member
sir i try this but not work

SET_BLOCK_PROPERTY('voumaster', DEFAULT_WHERE, 'where vtype='||''''||vtypev||'''' AND 'entdate='||''''||o_date(sysdate,'DD-MON-YYYY')||'''');

please give me idea

Re: try this but not work DEFAULT_WHERE, 'where vtype='||''''||vtypev||'''' AND 'entdate='||''''||o_ [message #180661 is a reply to message #180652] Tue, 04 July 2006 11:06 Go to previous messageGo to next message
saadatahmad
Messages: 452
Registered: March 2005
Location: Germany/Paderborn
Senior Member

:GLOBAL.gdate1 := '01-JAN-1980';
:GLOBAL.gdate2 := '01-DEC-1981';
:GLOBAL.deptno := 30;
SET_BLOCK_PROPERTY('EMP', DEFAULT_WHERE, 'deptno = '||:GLOBAL.deptno||' AND hiredate BETWEEN '||''''||:GLOBAL.gdate1||''''||' AND '||''''||:GLOBAL.gdate2||'''');


I don't want to replace it with your code, instead I want you to replace it with your code.

regards,
Saadat Ahmad
Re: how form opening time get data as per given date [message #180710 is a reply to message #180615] Tue, 04 July 2006 21:45 Go to previous message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
You may have noticed that the original version of this 'where' clause had multiple concatenated quotes eg ''' (3 quotes equals a real quote).

<minor rant>
Will you people please learn some BASIC debugging techniques!!
</minor rant>

Take the 'where' clause out of the 'set_block_property' and LOOK at what you are trying to execute.
:global.newparty :=0;	

declare
   vtypev    varchar2 (15);
   l_quote   varchar (10)   := '''';
   l_where   varchar2 (300);
BEGIN
   vtypev   := 'BPV';
   l_where  := 'where vtype='
               || l_quote
               || vtypev
               || l_quote
               || ' and entdate between ''01-07-2005'' and ''30-06-2006''';
   message ('l_where=>' || l_where || '<'); pause;
   set_block_property ('voumaster', default_where, l_where);
   go_block ('voumaster');
   execute_query;
   set_block_property ('voumaster', default_where, '');
END;

Doing it this way you would have found that you were missing numerous 'guotes'.

By the way, have you got your date in the correct format?

Try using a "to_date('01-07-2005','dd-mm-yyyy')" instead of a literal, especially if 'entdate' is of type 'date'.

David
Previous Topic: Multithread Application <Java & Oracle Forms>
Next Topic: menu bar
Goto Forum:
  


Current Time: Fri Sep 20 09:31:25 CDT 2024