Home » Developer & Programmer » Forms » Default where - URGENT
Default where - URGENT [message #79430] Mon, 10 June 2002 06:23 Go to next message
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 Go to previous messageGo to next message
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 Go to previous messageGo to next message
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 Go to previous messageGo to next message
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 #79464 is a reply to message #79439] Wed, 12 June 2002 05:56 Go to previous messageGo to next message
rosey
Messages: 13
Registered: May 2002
Junior Member
I don't know how to re-write the clause for a null value in one of the fields, can you please help me?

Thanks,
Rosey
Re: Default where - URGENT [message #79471 is a reply to message #79464] Wed, 12 June 2002 19:56 Go to previous message
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
Previous Topic: Forms
Next Topic: Running a report from within forms
Goto Forum:
  


Current Time: Thu Apr 18 22:38:17 CDT 2024