Home » Developer & Programmer » Forms » retriving the data according to where clause
retriving the data according to where clause [message #468557] Fri, 30 July 2010 11:49 Go to next message
Amar_bu
Messages: 32
Registered: July 2010
Location: riyadh
Member
Hi

I want if the user write for example in text box 'AM TK'
the query display the resualt which has am alone
tk alone, and that has both. I know that i should use the Like with % but i do not know how to write it in the set property.
I have wrote
set_block_property('Employee_Other',default_where,'Upper(name) like '''||UPPER(:key_search.person_name)||'''') ;

This will bring the resualt just if the user write am tk. How i can modify it to return value as i explained above. thanks

Re: retriving the data according to where clause [message #468567 is a reply to message #468557] Fri, 30 July 2010 12:48 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
You'd first have to split that string (i.e. from "AM TK" create "AM" and "TK"), and then create a WHERE clause as
some_name like '%AM%' or 
some_name like '%TK%' or 
some_name like '%AM TK%'
Re: retriving the data according to where clause [message #468571 is a reply to message #468567] Fri, 30 July 2010 13:25 Go to previous messageGo to next message
Amar_bu
Messages: 32
Registered: July 2010
Location: riyadh
Member
I do not want to restrict it for am and tk this is just example
what i am doing in my form is that i allow the user to enter the name i search the name in the database if the name exist i will display the information that related to it
Re: retriving the data according to where clause [message #468577 is a reply to message #468557] Fri, 30 July 2010 14:29 Go to previous messageGo to next message
Amar_bu
Messages: 32
Registered: July 2010
Location: riyadh
Member
set_block_property('Employee_Other',default_where,'Upper(name) like '''||'%'||UPPER(:key_search.person_name)||'%'||'''
or UPPER(office_name) Like '''||UPPER(:key_search.office_name)||''' or UPPER(other_types) like '''||UPPER(:key_search.other_type)||''' or UPPER(INFO_TEXT_En) like '''||UPPER(:key_search.information)||'''') ;

I have concatenate the % with the person name but it cause another problem it seems that the rest of line will be ignored.
Re: retriving the data according to where clause [message #468580 is a reply to message #468577] Fri, 30 July 2010 14:48 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Looking at your last message, it is quite different from the first one.

Anyway: why would you want to perform a query in such a complicated way? What's wrong with built-in Forms querying capabilities? Enter query mode, put any value(s) you want into items, you can even use variables (preceded with a colon sign, which will make it possible to do some quite complicated searches) and - execute query. What SET_BLOCK_PROPERTY? Why?
Re: retriving the data according to where clause [message #468600 is a reply to message #468580] Sat, 31 July 2010 00:51 Go to previous messageGo to next message
Amar_bu
Messages: 32
Registered: July 2010
Location: riyadh
Member
becuase what i have been asked to do is to make control block that has 4 text boxes if the user enter any of them i will display the value for the user in tabular block from the database.
Re: retriving the data according to where clause [message #468654 is a reply to message #468600] Sat, 31 July 2010 16:30 Go to previous message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
If that's the case, perhaps you could create a local variable (within the trigger) and put code that is supposed to act as a WHERE clause into that variable. Then display it (either in an item you'll create on the screen, or using the MESSAGE built-in). It might show why it isn't working as you'd like it to.
Previous Topic: Barcode integration with Oracle form
Next Topic: Showing the number of records affected (saved)
Goto Forum:
  


Current Time: Fri Sep 20 03:32:25 CDT 2024