SQL Scripts for Microsoft Dynamics GP: Update Item Resource Planning on Item Quantity Master from Text File

Microsoft Dynamics GPThis script is part of the SQL Scripts for Microsoft Dynamics GP where I will be posted the scripts I wrote against Microsoft Dynamics GP over the 19 years before I stopped working with Dynamics GP.

This script uses BULK INSERT to update the item resource planning fields on Item Quantity Master (IV00102).

/*
Created by Ian Grieve of azurecurve | Ramblings of an IT Professional (http://www.azurecurve.co.uk) This code is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0 Int). */
/* CREATE TEMP ERROR TABLE */ CREATE TABLE #Errors ( Error VARCHAR(1000) ,ROW_ID INT IDENTITY ) GO /* CREATE TEMP TABLE FOR DATA */ CREATE TABLE #IV00102_IMPORT ( ITEMNMBR VARCHAR(30) ,SHRINKAGEFACTOR NUMERIC(19,5) -- Shrinkage Factor ,PRCHSNGLDTM NUMERIC(19,5) -- Purchasing Lead Time ,MNFCTRNGFXDLDTM NUMERIC(19,5) -- Manufacturing Fixed Lead Time ,MNFCTRNGVRBLLDTM NUMERIC(19,5) -- Manufacturing Variable Lead Time ) GO /* BULK INSERT */ BULK INSERT #IV00102_IMPORT FROM 'c:\temp\ItemResourcePlanning.txt' WITH (FIELDTERMINATOR = '\t' ,ROWTERMINATOR = '\n' ,FIRSTROW = 2 ) GO /* VALIDATE DATA */ INSERT INTO #Errors (Error) --VALUES ( SELECT 'Item does not exist: ' + CAST(IMPORT.ITEMNMBR AS VARCHAR(100)) FROM #IV00102_IMPORT AS IMPORT LEFT JOIN IV00101 AS ['Item Master'] --Item Master (IV00101) ON ['Item Master'].ITEMNMBR = IMPORT.ITEMNMBR WHERE ['Item Master'].ITEMNMBR IS NULL ) GO INSERT INTO #Errors (Error) --VALUES ( SELECT 'Item/Site assignment does not exist: ' + CAST(IMPORT.ITEMNMBR AS VARCHAR(100)) + ' / MAIN' FROM #IV00102_IMPORT AS IMPORT LEFT JOIN IV00102 AS ['Item Quantity Master '] --Item Quantity Master (IV00102) ON ['Item Quantity Master '].ITEMNMBR = IMPORT.ITEMNMBR AND ['Item Quantity Master '].LOCNCODE = 'MAIN' WHERE ['Item Quantity Master '].ITEMNMBR IS NULL ) GO /* UPDATE EXISTING DATA IF NO ERRORS */ IF (SELECT COUNT(*) FROM #Errors) = 0 -- UPDATE if Email Details present UPDATE ['Item Quantity Master '] SET SHRINKAGEFACTOR = IMPORT.SHRINKAGEFACTOR ,PRCHSNGLDTM = IMPORT.PRCHSNGLDTM ,MNFCTRNGFXDLDTM = IMPORT.MNFCTRNGFXDLDTM ,MNFCTRNGVRBLLDTM = IMPORT.MNFCTRNGVRBLLDTM ,INCLDDINPLNNNG = 2 ,REPLENISHMENTMETHOD = 2 ,INCLDMRPMOVEIN = 2 ,INCLDMRPMOVEOUT = 2 ,INCLDMRPCANCEL = 2 FROM IV00102 AS ['Item Quantity Master '] --Item Quantity Master (IV00102) INNER JOIN #IV00102_IMPORT AS IMPORT ON IMPORT.ITEMNMBR = ['Item Quantity Master '].ITEMNMBR WHERE ['Item Quantity Master '].LOCNCODE = 'MAIN' GO /* OUTPUT ERRORS */ IF (SELECT COUNT(*) FROM #Errors) > 0 SELECT Error FROM #Errors ORDER BY ROW_ID GO /* DROP TEMP TABLES */ DROP TABLE #IV00102_IMPORT GO DROP TABLE #Errors GO

Click to show/hide the SQL Scripts for Microsoft Dynamics GP Series Index

Microsoft Edge Extension: Don’t Close Window With Last Tab

Useful ApplicationsWhile I mainly use the Vivaldi browser I do use Microsoft Edge for work related browsing. However, there is one feature of Vivaldi which I really miss when using Edge and that is when closing the last tab in the browser you’re returned to the speed dial.

With Edge when you closet the last tab, the entire browser closes; something which I always forget and am constantly annoyed by. I am so used to Vivaldi’s behaviour that I always close the last tab and then browse to the next page that I want. With Edge this means I end up closing the browser and having to relaunch it again.

I finally got around to looking for a solution to this and found the Don’t Close Window With Last Tab extension in the Microsoft Edge Add-ons store.

Download page for the add-on

Once installed the add-on keeps the browser open when the last tab is closed; it does handle additional windows by allowing the close of the last tab in the addtional window to close that window, which I”m happy enough to accept as I don;t often use multiple windows.

I’m posting this article mainly so that I can easily find the add-on on the multiple PCs I use so that I have a standard experience when browsing.