Home » Developer & Programmer » Forms » hoq to query records from multiple tables in the data block  () 1 Vote
hoq to query records from multiple tables in the data block [message #162935] Tue, 14 March 2006 03:59 Go to next message
insomniius
Messages: 20
Registered: June 2005
Location: pakistan
Junior Member
I have got two data blocks in the form from tables los_running_hrs and los_machine_oil.
These are the tables.

Los_running_hrs:

YEAR NUMBER(4),
MONTH NUMBER(2),
PLANT_NO NUMBER(1) NOT NULL,
TAG VARCHAR2(4 BYTE) NOT NULL,
TAG_UNIT NUMBER(2) NOT NULL,
TAG_SERIAL NUMBER(2) NOT NULL,
EQPT_SERIAL CHAR(1 BYTE) NOT NULL,
PART_NO VARCHAR2(2 BYTE) NOT NULL,
PART_CODE VARCHAR2(4 BYTE),
RUNNING_HRS NUMBER(6),
CHANGE_BASIS CHAR(1 BYTE),
CHANGE_MAKEUP_DATE DATE,
MAKEUP_QTY NUMBER(11,3),
DATA_CONTROL_NO NUMBER(4),
USER_ID VARCHAR2(20 BYTE),
CLIENT_ID VARCHAR2(20 BYTE),
TIME_STAMP DATE,
DELETE_FLAG CHAR(1 BYTE)

Los_machine_oil:

PLANT_NO NUMBER(1) NOT NULL,
TAG VARCHAR2(3 BYTE) NOT NULL,
TAG_UNIT NUMBER(2) NOT NULL,
TAG_SERIAL NUMBER(2) NOT NULL,
EQPT_SERIAL CHAR(1 BYTE) NOT NULL,
PART_NO VARCHAR2(2 BYTE) NOT NULL,
PART_CODE NUMBER(4),
PART_DESCRIPTION VARCHAR2(20 BYTE) NOT NULL,
OIL_DESCRIPTION VARCHAR2(13 BYTE) NOT NULL,
OIL_QTY_REQUIRED NUMBER(8,3) NOT NULL,
OIL_MEASURING_UNIT VARCHAR2(2 BYTE) NOT NULL,
CHANGE_FREQUENCY NUMBER(7),
CUMM_RUN_HRS NUMBER(7),
LIFE_RUN_HRS NUMBER(Cool,
REMARKS VARCHAR2(27 BYTE),
LAST_CHANGE_DATE DATE,
LAST_MAKEUP_DATE DATE,
CHANGE_COUNTER NUMBER(4),
USER_ID VARCHAR2(20 BYTE),
CLIENT_ID VARCHAR2(20 BYTE),
TIME_STAMP DATE,
DELETE_FLAG CHAR(1 BYTE)

All I want to make monthly transaction bvy giving month n yr n tag_unit in control block. If the user has already entered the data of certain record of specific month and year, I don’t want that record to come in the block. How I m going to write the query for that and how I m going to join two data blocks.
file is attached
Re: hoq to query records from multiple tables in the data block [message #162950 is a reply to message #162935] Tue, 14 March 2006 05:05 Go to previous messageGo to next message
sasi242
Messages: 11
Registered: March 2005
Location: india
Junior Member

Hi insomniius


1.To join the blocks Try to create a relation between both the
data blocks.
2.Use a pre query trigger in control block and validate whether
month,year,unit are null. if they are not null then pass that data to where clause

where month not in(:control.month)
and year not in (:control.year)
and unit not in (:control.unit)


Try to pass this where clause dynamically using
Default_where (built in)


Hope this will be helpful

Thank You
sasi242@gmail.com
Re: hoq to query records from multiple tables in the data block [message #163277 is a reply to message #162950] Wed, 15 March 2006 22:21 Go to previous message
insomniius
Messages: 20
Registered: June 2005
Location: pakistan
Junior Member
thanx buddy
i hve made it to some extent
Previous Topic: List Item Problem
Next Topic: something like dynamic data blocks?!
Goto Forum:
  


Current Time: Fri Sep 20 04:53:30 CDT 2024