Home » Developer & Programmer » Forms » where clause in the button for Database items (oracle forms 10g)
where clause in the button for Database items [message #624222] Fri, 19 September 2014 04:33 Go to next message
mist598
Messages: 1195
Registered: February 2013
Location: Hyderabad
Senior Member
Hi all,

master relationship blocks are XXC_HISTORY,HISTORY_DETAILS and Details Data Block HISTORY_DETAILS
Join condition HISTORY_DETAILS.HISTORY_ID = XXC_HISTORY.HISTORY_ID

1)XXC_HISTORY
2)HISTORY_DETAILS both are database blocks

and i need to create LOV's from XXC_HISTORY block items , items are Program_Name, Creation_date and need to add FIND button for XXC_HISTORY

Can you please how to create & what code need to be add ?

Please help
Re: where clause in the button for Database items [message #624225 is a reply to message #624222] Fri, 19 September 2014 04:58 Go to previous messageGo to next message
Littlefoot
Messages: 21807
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
List of values (LoV) displays result of a SELECT statement. Its source is a Record Group query. LoV should then be attached to a desired (set of) item(s).

So:
1. create record group query
2. create LoV based on that record group
3. while still in LoV wizard, choose item(s) affected by that LoV

When you run a form and set focus to that item, push the <List of values> key and LoV will open.
Re: where clause in the button for Database items [message #624228 is a reply to message #624225] Fri, 19 September 2014 05:04 Go to previous messageGo to next message
mist598
Messages: 1195
Registered: February 2013
Location: Hyderabad
Senior Member
XXC_HISTORY is the Data base block and can i create LOV on Data base Items ? yes we can right?

But in the FIND Button i need to write a query , i am selecting 1 or 2 lov's and clicked on the FIND Button, i need to display the details on the HISTORY_DETAILS Block

how to write a query in the Button?
Re: where clause in the button for Database items [message #624229 is a reply to message #624228] Fri, 19 September 2014 05:13 Go to previous messageGo to next message
Littlefoot
Messages: 21807
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Yes, you can create a LoV on a database item.

The only code you need to put into that FIND button's WHEN-BUTTON-PRESSED trigger is
execute_query;
As these blocks are in master-detail relationship, Forms will do the rest.
Re: where clause in the button for Database items [message #624231 is a reply to message #624229] Fri, 19 September 2014 05:30 Go to previous messageGo to next message
mist598
Messages: 1195
Registered: February 2013
Location: Hyderabad
Senior Member
Hi Littlefoot,

I created LOV(wizard type based on the select statement) on the database items, clicked on the VIW Button it navigates to the another block(canvas)

in that canvas i have 3 LOV's and 1 FIND Button, this is fine

But the LOV(at the run time) it was showing the LOV field as normal text why?

Re: where clause in the button for Database items [message #624233 is a reply to message #624229] Fri, 19 September 2014 05:44 Go to previous messageGo to next message
mist598
Messages: 1195
Registered: February 2013
Location: Hyderabad
Senior Member
Like a disable mode
Re: where clause in the button for Database items [message #624238 is a reply to message #624222] Fri, 19 September 2014 06:26 Go to previous messageGo to next message
mist598
Messages: 1195
Registered: February 2013
Location: Hyderabad
Senior Member
can any one please help?
Re: where clause in the button for Database items [message #624239 is a reply to message #624238] Fri, 19 September 2014 06:43 Go to previous messageGo to next message
Littlefoot
Messages: 21807
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I don't understand what you are trying to say. Could you post a screenshot which displays the problem?
Re: where clause in the button for Database items [message #624246 is a reply to message #624239] Fri, 19 September 2014 07:51 Go to previous messageGo to next message
mist598
Messages: 1195
Registered: February 2013
Location: Hyderabad
Senior Member
Hi Littlefoot,

1)can i create JOIN Between Non-datebase and database block

I have non-database and database block both are different tables XXC_HISTORY,HISTORY_DETAILS
HISTORY_ID's are the JOIN condition.

I need to take LOV's & FIND Button in the non-database block

SELECT HISTORY_ID,program_name,creation_date FROM xxc_purge_history (LOV table)
select HISTORY_ID,TABLE_NAME ,creation_date from HISTORY_DETAILS

If i select program_name,creation_date (from the LOV's) need to diaplay at the database block

Can you please give me the steps?
Re: where clause in the button for Database items [message #624267 is a reply to message #624246] Fri, 19 September 2014 14:34 Go to previous messageGo to next message
Littlefoot
Messages: 21807
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
mist598

1)can i create JOIN Between Non-datebase and database block

Try it and you'll see.

Quote:

I have non-database and database block both are different tables XXC_HISTORY,HISTORY_DETAILS
HISTORY_ID's are the JOIN condition.

Red & blue don't fit together. If one of them is a non-database block and another one is a database block, then they BOTH can't be based on underlying tables - just one can.
Or, if they are based on tables, then both of them ARE database blocks.

Quote:

I need to take LOV's & FIND Button in the non-database block (...) If i select program_name,creation_date (from the LOV's) need to diaplay at the database block

If they are in a non-database block, master-detail relationship won't work (i.e. you can't even create it). It means that you'll have to query the detail block manually, by setting ONETIME_WHERE (using SET_BLOCK_PROPERTY) which would use values you select by LoVs. And, of course, EXECUTE_QUERY.
Re: where clause in the button for Database items [message #624274 is a reply to message #624222] Sat, 20 September 2014 00:47 Go to previous messageGo to next message
mist598
Messages: 1195
Registered: February 2013
Location: Hyderabad
Senior Member
Hi ,

1)It is custom form
2) XXC_HISTORY,HISTORY_DETAILS 2 database blocks
3)having master detail realtionship with HISTORY_ID column's on the both tables
4) need to create LOV on program_name,creation_date columns on the XXC_HISTORY database block and also add one find button in the same block
5) if i click on the FIND Button need to display data on HISTORY_DETAILS block
and columns are HISTORY_ID,TABLE_NAME,CREATION_DATE

Created LOV on the program_name,creation_date columns on the XXC_HISTORY database block, the LOV's showing like a "display Item" see the below picture
/forum/fa/12176/0/

Please help me how to do this?
  • Attachment: image1.png
    (Size: 0.89KB, Downloaded 822 times)

[Updated on: Sat, 20 September 2014 00:48]

Report message to a moderator

Re: where clause in the button for Database items [message #624276 is a reply to message #624274] Sat, 20 September 2014 00:55 Go to previous messageGo to next message
Littlefoot
Messages: 21807
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
LoV IS attached to an item, but it doesn't make it a "Display item". When looking at a form (built by a wizard), there's no way to know which item does have a LoV and which does not.

For the rest of your questions, I believe I answered them already throughout this discussion, so I'm not going to repeat them again and I'm certainly not going to write that form for you (as it seems that I'm incapable of pointing you into the right direction). Perhaps you should wait for someone else to assist.
Re: where clause in the button for Database items [message #624277 is a reply to message #624276] Sat, 20 September 2014 01:04 Go to previous messageGo to next message
mist598
Messages: 1195
Registered: February 2013
Location: Hyderabad
Senior Member
Hi Littlefoot,

I checked all the properties of that LOV item please see the below screen.
/forum/fa/12179/0/
  • Attachment: image2.png
    (Size: 9.35KB, Downloaded 804 times)
Re: where clause in the button for Database items [message #624284 is a reply to message #624277] Sat, 20 September 2014 03:22 Go to previous messageGo to next message
Littlefoot
Messages: 21807
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
What are we supposed to do with that?
Re: where clause in the button for Database items [message #624285 is a reply to message #624284] Sat, 20 September 2014 03:32 Go to previous messageGo to next message
mist598
Messages: 1195
Registered: February 2013
Location: Hyderabad
Senior Member
Thanks Littlefoot, i go the solution..let me testing first.. Smile

I checked all the properties and details about program_name column i am asking why the database filed not behaving like LOV ?

Re: where clause in the button for Database items [message #624286 is a reply to message #624285] Sat, 20 September 2014 03:38 Go to previous messageGo to next message
Littlefoot
Messages: 21807
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Quote:

i am asking why the database filed not behaving like LOV ?

What does that mean? How does the LoV behave, as opposed to a database field?
Re: where clause in the button for Database items [message #624287 is a reply to message #624286] Sat, 20 September 2014 03:44 Go to previous messageGo to next message
mist598
Messages: 1195
Registered: February 2013
Location: Hyderabad
Senior Member
Quote:
What does that mean? How does the LoV behave, as opposed to a database field?

I created LOV as wizard type and attached to that column related database block

and why? that database field is not created as LOV, why it is showing as "display item"
Re: where clause in the button for Database items [message #624288 is a reply to message #624287] Sat, 20 September 2014 04:17 Go to previous messageGo to next message
Littlefoot
Messages: 21807
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I told you already. Items don't make themselves "display items", nor LoVs do that. It was you who set it to be a "display item". If you don't want that, modify its properties and set it to be a "text item".
Re: where clause in the button for Database items [message #624289 is a reply to message #624288] Sat, 20 September 2014 04:21 Go to previous messageGo to next message
mist598
Messages: 1195
Registered: February 2013
Location: Hyderabad
Senior Member
Quote:
I told you already. Items don't make themselves "display items", nor LoVs do that. It was you who set it to be a "display item". If you don't want that, modify its properties and set it to be a "text item".

Hi Littlefoot,it is not a "display item" , it is a "text item"
Re: where clause in the button for Database items [message #624290 is a reply to message #624289] Sat, 20 September 2014 04:44 Go to previous messageGo to next message
Littlefoot
Messages: 21807
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Didn't you say
Quote:

why it is showing as "display item"
Re: where clause in the button for Database items [message #624335 is a reply to message #624290] Mon, 22 September 2014 01:55 Go to previous messageGo to next message
mist598
Messages: 1195
Registered: February 2013
Location: Hyderabad
Senior Member
Hi Littlefoot..

DECLARE 
    finalstr     VARCHAR2(5000); 
    dfinalstr    VARCHAR2(5000); 
    CURSOR c1 
    IS 
     SELECT DISTINCT id
                FROM xxc_history 
               WHERE name = :block.name
                 AND trunc(creation_date) BETWEEN :block.date_from AND :block.date_to;

BEGIN 
    FOR c_rec IN c1 LOOP 
        IF c_rec.id IS NOT NULL THEN 
          v_id := c_rec.id; 
              finalstr := 'WHERE 1=1'; 
              finalstr := finalstr ||' AND id  = ' ||v_id; 
              Go_block('xxc_DETAILS'); 

              dfinalstr := Get_block_property('xxc_DETAILS', default_where ); 

              Set_block_property('xxc_DETAILS', default_where, finalstr) ; 

              Execute_query(); 

        END IF; 
     END LOOP; 
END; 

I have written the above code into the FIND Button ,From the cursor between 2 dates i am getting 22 records , but after clicked on the Button i am getting only 9 Records

can you please help me what is the issue in my code?

[Updated on: Mon, 22 September 2014 01:56]

Report message to a moderator

Re: where clause in the button for Database items [message #624339 is a reply to message #624335] Mon, 22 September 2014 03:29 Go to previous message
Littlefoot
Messages: 21807
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
A cursor C1 finds 22 distinct IDs from XXC_HISTORY table.

If EXECUTE_QUERY returns only 9 rows into a form block, it means that XXC_DETAILS table doesn't contain records related to all IDs from the XXC_HISTORY table.
Previous Topic: Oracle forms
Next Topic: Forms 11g JDK version 1.6.0_12 Runtime opening blank screen
Goto Forum:
  


Current Time: Sat Apr 20 00:52:23 CDT 2024