Default where - URGENT [message #79430] |
Mon, 10 June 2002 06:23 |
rosey
Messages: 13 Registered: May 2002
|
Junior Member |
|
|
hello,
I need my default where clause on my block to be "like" one condition and equal to another but I can only get the results to work for one and not the other. Can you not use both "LIKE" and "=" in a where clause.
Example:
set_block_property('block_two', default_where, 'course = block_one.course or title like block_one.title);
This is really urgent if someone can help me.
Thank you
|
|
|
Re: Default where - URGENT [message #79439 is a reply to message #79430] |
Mon, 10 June 2002 21:01 |
Remash
Messages: 52 Registered: November 2000
|
Member |
|
|
Hi
You need to put the text field within quotes. Rewrite the default where clause as follows:
set_block_property('block_two', default_where, 'course = '||''''||:block_one.course||''''||' or title like '||''''||:block_one.title||'%'||'''');
Hope this will help you.
Regards
|
|
|
Re: Default where - URGENT [message #79448 is a reply to message #79439] |
Tue, 11 June 2002 07:42 |
rosey
Messages: 13 Registered: May 2002
|
Junior Member |
|
|
Thank you Ramesh but no dice :(
With your suggestion, I get the appropriate records for the title column but if i enter in course code, I get every record!
|
|
|
Re: Default where - URGENT [message #79462 is a reply to message #79439] |
Tue, 11 June 2002 20:47 |
Remash
Messages: 52 Registered: November 2000
|
Member |
|
|
Hi Rosy
This default-where clause is applicable if title and course fields are not null. If one of them is null you need to re-write the clause. Display and see the where-clause before execute-query.
Regards
|
|
|
|
Re: Default where - URGENT [message #79471 is a reply to message #79464] |
Wed, 12 June 2002 19:56 |
Remash
Messages: 52 Registered: November 2000
|
Member |
|
|
Hi Rosey
Here it is.
Go_Block('block_two');
Clear_BLock(No_Validate);
If :block_one.course is Null Then
If :block_one.title is Not Null Then
set_block_property('block_two', default_where, 'title like '||''''||:block_one.title||'%'||'''');
End if;
Else
If :block_one.title is Null Then
set_block_property('block_two', default_where, 'course = '||''''||:block_one.course||'''');
Else
set_block_property('block_two', default_where, 'course = '||''''||:block_one.course||''''||' or title like '||''''||:block_one.title||'%'||'''');
End if;
End if;
EXECUTE_QUERY;
-- If course and title are null then it shows all the records
Regards
|
|
|