auto fill fields

This public forum is for user-to-user discussions of ASP.NET Maker. Note that this is not support forum.
Post Reply
gjhfox
User
Posts: 2

auto fill fields

Post by gjhfox »

Hello,
i need you to help me with something...i am trying to auto fill some fields of a detail table with values of another detail table ...i need to filter with a field in the first master table...for example...

i need to select ResultadEstudios.NroItem and fill fields "grupo, detalle, unidades, valoresDeReferencia" with of ResultadosEstudios table with "grupo, detalle, unidades, valoresDeReferencia" from DetallesTipoEstudios considering DetallesTipoEstudios.IdTipoEstudio is the same as EstudiosPacientes.IdTipoEstudio because is the master table.

How can i do that?

tables:
USE [EstudiosBioquimicos]
CREATE TABLE [dbo].[DetallesTipoEstudios](
[IdTipoEstudio] [numeric](4, 0) NOT NULL,
[NroItem] [numeric](2, 0) NOT NULL,
[grupo] varchar NOT NULL,
[Detalle] varchar NOT NULL,
[Unidades] varchar NULL,
[ValoresDeReferencia] varchar NULL,
CONSTRAINT [PK_DetallesTipoEstudios] PRIMARY KEY CLUSTERED
(
[IdTipoEstudio] ASC,
[NroItem] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

CREATE TABLE [dbo].[EstudiosPacientes](
[IdEstudio] [numeric](8, 0) IDENTITY(1,1) NOT NULL,
[Fecha] [date] NOT NULL,
[IdTipoEstudio] [numeric](4, 0) NOT NULL,
[IdPaciente] [numeric](6, 0) NOT NULL,
[IdBioquimico] [numeric](6, 0) NOT NULL,
[Finalizado] [date] NULL,
[Obervaciones] [text] NULL,
CONSTRAINT [PK_EstudiosPacientes] PRIMARY KEY CLUSTERED
(
[IdEstudio] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

CREATE TABLE [dbo].[ResultadosEstudios](
[IdEstudio] [numeric](8, 0) NOT NULL,
[NroItem] [numeric](2, 0) NOT NULL,
[Grupo] varchar NULL,
[Detalle] varchar NOT NULL,
[Resultado] varchar NOT NULL,
[Unidades] varchar NULL,
[ValoresDeReferencia] varchar NULL,
[Imagen] [image] NULL,
[Obervaciones] varchar NULL,
CONSTRAINT [PK_ResultadosEstudios] PRIMARY KEY CLUSTERED
(
[IdEstudio] ASC,
[NroItem] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]


motfs
User
Posts: 258

Post by motfs »

If you use Master/Detail-Add/Edit, try to use Auto-Fill feature. Read Lookup-Table -> Auto fill in help file for more details.


gjhfox
User
Posts: 2

Post by gjhfox »

i think i didn´t explain my problem correctly, perhaps i could use storage procedure or sql insert in Row_Inserted
event in the master table EstudiosPacientes and using the idTipoEstudio field value as a parameter calling a storage procedutre (or write the code in c#) to insert that specifics rows on detail table ResultadosEstudiosPaciente ?

because i need the rows of the detail table detallesEstudiosPacientes inserted into table resultadosEstudiosPacientes considering IdTipoEstudio of the inserted row master table EstudiosPacientes value.

in other words...when a row is inserted in Master table EstudiosPacientes with a certain value of IdTipoEstudio, select rows in detail table DetallesEstudiosPacientes filtering DetallesEstudiosPacientes .idTipoEstudio = EstudiosPacientes.idTipoEstudio and insert those rows into detail table ResultadosEstudiosPacientes.

How can i do that?


Post Reply