Home » Developer & Programmer » Forms » Problem on search by character . (Oracle 10g Developer Suite)  () 1 Vote
Problem on search by character . [message #455306] Tue, 11 May 2010 01:38 Go to next message
limit
Messages: 16
Registered: December 2006
Location: Dhaka, Bangladesh.
Junior Member

I have two table:
Table 1:
CREATE TABLE Test1
(
FI_ID INTEGER NOT NULL,
FI_CLASS_ID INTEGER NOT NULL,
)
ALTER TABLE Test1 ADD (
CONSTRAINT PK_Test1 PRIMARY KEY (FI_ID, FI_CLASS_ID)

ALTER TABLE Test1 ADD (CONSTRAINT FK_Test1_FI FOREIGN KEY FI_ID)
REFERENCES Test2 (FI_ID))

Table 2:
CREATE TABLE Test2
(
FI_ID INTEGER NOT NULL,
FI_NM VARCHAR2(60 BYTE) NOT NULL,
FI_ALIAS
)
ALTER TABLE Test2 (
CONSTRAINT PK_Test2
PRIMARY KEY
(FI_ID)

I am working on the table Test1. And also display data of Test1 in Form. I already have displayed 'FI_NM' against 'FI-ID' using Form Trigger Post-Query in the Form.

And also I have a text field and a Button named 'Search'. When I input any character in a text field and press Button then display error: "Query caused no records to be retrieved." But I input numeric value the display data in the form block.

For that I am using the following codes in
When-button-pressed:

:GLOBAL.TXT_ITEM :='%' || UPPER(:BLK_TEMP.TXT_FI_ID_NAME) || '%';

BEGIN
SET_BLOCK_PROPERTY('Test1', ONETIME_WHERE, 'FI_ID LIKE :GLOBAL.TXT_ITEM');
go_block('Test1');
EXECUTE_QUERY(NO_VALIDATE);

EXCEPTION
WHEN OTHERS THEN
NULL;
END;

Please help and also tell how to solve that problem.

Regards,
Noor
Re: Problem on search by character . [message #455310 is a reply to message #455306] Tue, 11 May 2010 02:11 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Try changing
SET_BLOCK_PROPERTY('Test1', ONETIME_WHERE, 'FI_ID LIKE :GLOBAL.TXT_ITEM');
to
SET_BLOCK_PROPERTY('Test1', ONETIME_WHERE, 'FI_ID LIKE ''||:GLOBAL.TXT_ITEM||''');

David
Re: Problem on search by character . [message #455313 is a reply to message #455310] Tue, 11 May 2010 02:32 Go to previous messageGo to next message
limit
Messages: 16
Registered: December 2006
Location: Dhaka, Bangladesh.
Junior Member

When I use:
SET_BLOCK_PROPERTY('Test1', ONETIME_WHERE, 'FI_ID LIKE :GLOBAL.TXT_ITEM');
and also I input no numeric value or character, display all records. and
I input only numeric(1 or 11) value then display result, if match with FI_ID. And I input only character then display an error: "Query caused no records to be retrieved.".

When I use:
SET_BLOCK_PROPERTY('Test1', ONETIME_WHERE, 'FI_ID LIKE ''||:GLOBAL.TXT_ITEM||''');
Always display an error: "Query caused no records to be retrieved."

I want to display result by searching character value not numeric value.

Please give solution asap.
Please see the attached JPG file for quick understand what I need.
  • Attachment: Test1.JPG
    (Size: 49.59KB, Downloaded 626 times)

[Updated on: Tue, 11 May 2010 02:46]

Report message to a moderator

Re: Problem on search by character . [message #455319 is a reply to message #455313] Tue, 11 May 2010 02:52 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Assign the test "FI_ID LIKE ''||:GLOBAL.TXT_ITEM||''" to a variable, place a 'message;pause;' command pair after the 'set_block_property' and before the 'go_block' and display the contents of assigned variable.

Tell us what it says and what you wanted it to say.

David
Re: Problem on search by character . [message #455321 is a reply to message #455319] Tue, 11 May 2010 02:54 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
I strongly recommend that you do not use 'ASAP' again. This is a voluntary activity for us all and we will provide a solution or guidance as and when possible.

David

PS I am now going home so someone else will have to provide answers to you for the next 20 hours.

[Updated on: Wed, 12 May 2010 01:22]

Report message to a moderator

Re: Problem on search by character . [message #455322 is a reply to message #455321] Tue, 11 May 2010 02:56 Go to previous messageGo to next message
limit
Messages: 16
Registered: December 2006
Location: Dhaka, Bangladesh.
Junior Member

Please see my sending attached form jpg.
  • Attachment: Test1.JPG
    (Size: 49.59KB, Downloaded 602 times)

[Updated on: Tue, 11 May 2010 02:57]

Report message to a moderator

Re: Problem on search by character . [message #455326 is a reply to message #455322] Tue, 11 May 2010 03:21 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Unless I'm wrong, you'll NEVER find anything with this approach.

TEST1.FI_ID is INTEGER. How do you expect it to work if you enter a "character" into the search item and, later, use (one of the following variations):

SET_BLOCK_PROPERTY('Test1', ONETIME_WHERE, 'FI_ID LIKE :GLOBAL.TXT_ITEM');

As FI_ID is a number, you can't even store character values in there so ... the whole idea is wrong.

What do you, actually, want to do? Search what? FI_IDs? Names? If the latter, no way as it doesn't belong to a table data block is based on. You'll either have to create a view or, possibly, search via List of values (where you'd see "name" along with its ID).
Re: Problem on search by character . [message #455328 is a reply to message #455326] Tue, 11 May 2010 03:28 Go to previous messageGo to next message
limit
Messages: 16
Registered: December 2006
Location: Dhaka, Bangladesh.
Junior Member

When I input A then display a message "FI_ID LIKE %A%"
Re: Problem on search by character . [message #455330 is a reply to message #455328] Tue, 11 May 2010 03:32 Go to previous messageGo to next message
limit
Messages: 16
Registered: December 2006
Location: Dhaka, Bangladesh.
Junior Member

I want to search by letter.
How can I assign name against FI_ID?
I need a solution through set_block_property.
Re: Problem on search by character . [message #455331 is a reply to message #455330] Tue, 11 May 2010 03:39 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
You can do it with a sub-query:
SET_BLOCK_PROPERTY('Test1', ONETIME_WHERE,
                   'FI_ID IN (SELECT FI_ID FROM Test2 WHERE FI_NM LIKE ''||:GLOBAL.TXT_ITEM||'')');

[EDITED by DJM: cut overly long line]

[Updated on: Wed, 12 May 2010 01:43] by Moderator

Report message to a moderator

Re: Problem on search by character . [message #455332 is a reply to message #455331] Tue, 11 May 2010 03:53 Go to previous messageGo to next message
limit
Messages: 16
Registered: December 2006
Location: Dhaka, Bangladesh.
Junior Member

After using:
SET_BLOCK_PROPERTY('Test1', ONETIME_WHERE, 'FI_ID IN (SELECT FI_ID FROM Test2 WHERE FI_NM LIKE ''||:GLOBAL.TXT_ITEM||'')');

display an error: "Query caused no records to be retrieved."
Re: Problem on search by character . [message #455334 is a reply to message #455332] Tue, 11 May 2010 04:00 Go to previous messageGo to next message
limit
Messages: 16
Registered: December 2006
Location: Dhaka, Bangladesh.
Junior Member

Your idea probably going to correct nearly.
I hide FI_ID from that block. and then create new non database item TXT_FI_ID_NAME for displaying FI_NM against FI_ID.
Please keep contact with me.
Re: Problem on search by character . [message #455336 is a reply to message #455334] Tue, 11 May 2010 04:10 Go to previous messageGo to next message
limit
Messages: 16
Registered: December 2006
Location: Dhaka, Bangladesh.
Junior Member

Can I use
SET_BLOCK_PROPERTY('STG_A_FI_X_FI_CLASS', ONETIME_WHERE,
                   'FI_ID IN (SELECT FI_NM INTO TXT_FI_NAME FROM STG_D_FI WHERE FI_NM LIKE ''||:GLOBAL.TXT_ITEM||'')');

[EDITED by DJM: cut overly long line]

[Updated on: Wed, 12 May 2010 01:44] by Moderator

Report message to a moderator

Re: Problem on search by character . [message #455337 is a reply to message #455336] Tue, 11 May 2010 04:21 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
No. You can't use SELECT INTO in a where clause.
Use my code and then use:
GET_BLOCK_PROPERTY('STG_A_FI_X_FI_CLASS', last_query);
To find out exactly what query was issued to the DB.
Re: Problem on search by character . [message #455338 is a reply to message #455336] Tue, 11 May 2010 04:23 Go to previous messageGo to next message
limit
Messages: 16
Registered: December 2006
Location: Dhaka, Bangladesh.
Junior Member

SET_BLOCK_PROPERTY('Test1', ONETIME_WHERE, 'FI_ID IN (SELECT FI_NM FROM Test2 WHERE FI_NM LIKE ''||:GLOBAL.TXT_ITEM||'')');

is perfect. But FI_ID is numeric value.
This way, how can I assign FI_NM into :STG_A_FI_X_FI_CLASS.TXT_FI_NAME?
Re: Problem on search by character . [message #455340 is a reply to message #455338] Tue, 11 May 2010 04:32 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
limit wrote on Tue, 11 May 2010 10:23
SET_BLOCK_PROPERTY('Test1', ONETIME_WHERE, 'FI_ID IN (SELECT FI_NM FROM Test2 WHERE FI_NM LIKE ''||:GLOBAL.TXT_ITEM||'')');

is perfect. But FI_ID is numeric value.

How is that perfect exactly? You're checking if a numeric is in a character.

limit wrote on Tue, 11 May 2010 10:23

This way, how can I assign FI_NM into :STG_A_FI_X_FI_CLASS.TXT_FI_NAME?

With a select statement? In the post-query trigger?
Re: Problem on search by character . [message #455344 is a reply to message #455340] Tue, 11 May 2010 04:49 Go to previous messageGo to next message
limit
Messages: 16
Registered: December 2006
Location: Dhaka, Bangladesh.
Junior Member

Exactly I need checking character and then display into :STG_A_FI_X_FI_CLASS.TXT_FI_NAME
Re: Problem on search by character . [message #455346 is a reply to message #455337] Tue, 11 May 2010 04:54 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
cookiemonster wrote on Tue, 11 May 2010 10:21

Use my code and then use:
GET_BLOCK_PROPERTY('STG_A_FI_X_FI_CLASS', last_query);
To find out exactly what query was issued to the DB.
Re: Problem on search by character . [message #455348 is a reply to message #455346] Tue, 11 May 2010 04:59 Go to previous messageGo to next message
limit
Messages: 16
Registered: December 2006
Location: Dhaka, Bangladesh.
Junior Member

Returning error when I compile it. GET_BLOCK_PROPERTY is not a procedure or undefined
Re: Problem on search by character . [message #455362 is a reply to message #455348] Tue, 11 May 2010 06:15 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
It's a function.
Create a new item in your datablock, put it on the canvas, make sure it's set to be a non-database item.
Set it's datatype to character and it's length to 4000.
Add a button. In the WHEN-BUTTON-PRESSED put:
:STG_A_FI_X_FI_CLASS.<whatever your item is called> := GET_BLOCK_PROPERTY('STG_A_FI_X_FI_CLASS', last_query);

Press the button after running the query and post the result here.
Re: Problem on search by character . [message #455369 is a reply to message #455362] Tue, 11 May 2010 06:31 Go to previous messageGo to next message
limit
Messages: 16
Registered: December 2006
Location: Dhaka, Bangladesh.
Junior Member

No output return...
Re: Problem on search by character . [message #455370 is a reply to message #455369] Tue, 11 May 2010 06:33 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
SYNCHRONIZE, perhaps? (after GET_BLOCK_PROPERTY) How does your code look like, now, after all you've done?
Re: Problem on search by character . [message #455374 is a reply to message #455370] Tue, 11 May 2010 06:41 Go to previous messageGo to next message
limit
Messages: 16
Registered: December 2006
Location: Dhaka, Bangladesh.
Junior Member

I want to search by character not numeric value. Matching FI_ID then assign FI_NM into txt_FI_name non db item.
Re: Problem on search by character . [message #455381 is a reply to message #455370] Tue, 11 May 2010 06:58 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Yes, it is quite clear what you want to do.

Littlefoot
How does your code look like, now, after all you've done?

Re: Problem on search by character . [message #455550 is a reply to message #455381] Wed, 12 May 2010 02:12 Go to previous messageGo to next message
limit
Messages: 16
Registered: December 2006
Location: Dhaka, Bangladesh.
Junior Member

Please help me to do that task.
If you are clear on my requirements, Please send details.
Re: Problem on search by character . [message #455571 is a reply to message #455550] Wed, 12 May 2010 03:46 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
The code I gave you originally should work.
Since it didn't I gave you additional code to run to enable us to debug the problem.
Since that didn't appear to work either Littlefoot asked you to post your current code so that we can see exactly what you have done.
Without that we can not help you further.
Re: Problem on search by character . [message #455591 is a reply to message #455571] Wed, 12 May 2010 04:19 Go to previous messageGo to next message
limit
Messages: 16
Registered: December 2006
Location: Dhaka, Bangladesh.
Junior Member

When-button-pressed:trigger

:GLOBAL.TXT_ITEM :='%' || UPPER(:BLK_TEMP.TXT_FI_ID_NAME) || '%';

BEGIN
SET_BLOCK_PROPERTY('Test1', ONETIME_WHERE, 'FI_ID LIKE :GLOBAL.TXT_ITEM');
go_block('Test1');
EXECUTE_QUERY(NO_VALIDATE);

EXCEPTION
WHEN OTHERS THEN
NULL;
END;
Re: Problem on search by character . [message #455599 is a reply to message #455591] Wed, 12 May 2010 04:33 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
That doesn't look anything like the code I told you use.
Use my code.
And don't ever code:
EXCEPTION
WHEN OTHERS THEN
NULL;


We want to see errors. it's the only way we'll find out what the problem is.
Re: Problem on search by character . [message #455761 is a reply to message #455591] Wed, 12 May 2010 20:54 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Where are your 'message;pause;' pairs?

David
Re: Problem on search by character . [message #456294 is a reply to message #455761] Mon, 17 May 2010 02:10 Go to previous messageGo to next message
limit
Messages: 16
Registered: December 2006
Location: Dhaka, Bangladesh.
Junior Member

Ya,
I have solved my problem.

Thanks everybody...
Re: Problem on search by character . [message #456306 is a reply to message #456294] Mon, 17 May 2010 03:12 Go to previous message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
Would you like to share the solution?
It'll be helpfull for anyone else who hits the same problem.

EDIT: typo

[Updated on: Mon, 17 May 2010 03:13]

Report message to a moderator

Previous Topic: delete_record not removing record from screen
Next Topic: problem using java bean with baseHTMLjinitiator=basejpi.htm ?
Goto Forum:
  


Current Time: Fri Sep 20 09:45:15 CDT 2024