Skip to Content
0
Aug 22, 2023 at 02:55 AM

SQL FMS not working (automatically / Refresh)

105 Views

Hi expert,

I have created SQL FMS. the problem its not working except manually click the magnifying icon on the field. here is the code below. also the User deficed values setup is set to "Auto Refresh". Thank you in advance.

declare @Remarks INT

declare @ItemC VARCHAR (200)

declare @ItmWhsStts nVARCHAR (20)

SET @Remarks = $[ORDR.U_Remarks]

SET @ItemC = $[RDR1.ItemCode]

IF @Remarks = 1

BEGIN

DECLARE @WH_QOH NUMERIC(9,6), @DIFF NUMERIC(9,6)

SET @WH_QOH = $[RDR1.U_InStockWarehouses]

SET @DIFF = $[RDR1.U_ORDERDIFF]

IF @DIFF < 1 AND ISNULL(cast(@WH_QOH as numeric(9,6)), 0.000000) >= 1 AND ISNULL(@ItemC, '') <> ''

Begin

select distinct @ItmWhsStts = c.U_WhStatus

From OITM c where c.ItemCode = $[RDR1.ItemCode]

if @ItmWhsStts = 'PH'

begin

SELECT 18

end

ELSE

SELECT 24

end

ELSE IF @DIFF < 1 AND ( ISNULL(@WH_QOH, 0.000000) = 0 OR CONVERT(NVARCHAR(12),@WH_QOH) = '') AND ISNULL(@ItemC, '') <> ''

Begin

select distinct @ItmWhsStts = c.U_WhStatus

From OITM c where c.ItemCode = $[RDR1.ItemCode]

if @ItmWhsStts = 'PH'

begin

SELECT 18

end

ELSE

SELECT 1

end

END

ELSE

SELECT 0