cancel
Showing results for 
Search instead for 
Did you mean: 

Bloqueo campo usuario

martin_romano3
Explorer
0 Kudos

Estimados

en la oferta de ventas (object type 23) he creado un campo de usuario que almacena cantidades (numeric 19,6) en la qut1

bueno debo crear un bloqueo para que no permita grabar la transaccion si no esta lleno el mismo

he aca mis intentos

IF @object_type = 23 and @transaction_type in ('A','U')

BEGIN

declare @referen varchar(10)

SET @referen = (select Top 1 t1.U_quant from QUT1 t1

INNER JOIN OQUT T0 ON T1.DocEntry=T0.DocEntry 

  WHERE T0.DocEntry = @list_of_cols_val_tab_del )

if @referen is null

begin

set @error = 1

set @error_message = 'Falta referencia22'

end

END

y esta otra

--IF @object_type=23 AND @transaction_type IN ('A','U') 

--BEGIN 

--          DECLARE 

--                    @Item NVARCHAR(20) 

   

--          SET @Item = ( 

--                                        SELECT TOP 1 T1.U_Quant

--                                        FROM OQUT T0 

--                                        INNER JOIN QUT1 T1 ON T1.DocEntry=T0.DocEntry 

--                                        WHERE T0.DocEntry = @list_of_cols_val_tab_del )

                                         

--          IF @Item IS NULL 

--          BEGIN 

--                    SELECT @error=777, @error_message='No puede cambiar la descripcion del articulo '+@Item 

--          END 

--END

no me funcionan

una ayuda por favor

Accepted Solutions (0)

Answers (2)

Answers (2)

felipe_loyolarodriguez
Active Contributor
0 Kudos

Buenas

Prueba lo siguiente

IF @object_type=23 AND @transaction_type IN ('A','U')

BEGIN

          DECLARE

                    @Item NVARCHAR(20)

          SET @Item = isnull((

                                        SELECT TOP 1 T1.U_Quant

                                        FROM OQUT T0

                                        INNER JOIN QUT1 T1 ON T1.DocEntry=T0.DocEntry

                                        WHERE T0.DocEntry = @list_of_cols_val_tab_del ),'0')

                                       

          IF @Item <> '0'

          BEGIN

                    SELECT @error=777, @error_message='ERROR'

          END

END

Saludos

FLR

former_member203638
Active Contributor
0 Kudos

Hola martin, Intenta así:


IF @object_type = '23' AND @transaction_type in ('U','A')

BEGIN

    IF (select count(*)

      from QUT1 T0

      where (T0.u_campo = '' or T0.u_campo is null)

      and T0.DocEntry = @list_of_cols_val_tab_del)>0

    begin

        SELECT @error= 10

        SELECT @error_message = 'Tu mensaje al usuario'

    end

end

Saludos.