Wednesday, March 22, 2017

Dynamics NAV - LS Retail - Block purchasing or sales

Item Status Link - set blocking rules
This affects Purchasing, Sales

Table 39 - Checkitemstatus
C 99001452 - boutils, finditemstatuslink

The suspend routine checks the Document date, and the line location.
If a suspend status is set for a specific time range, that item will be suspended until another active line date is entered.

Tuesday, March 21, 2017

SQL - how to use temp tables

sp_configure 'Show Advanced Options', 1 GO RECONFIGURE GO sp_configure 'Ad Hoc Distributed Queries', 1 GO RECONFIGURE GO 


--Select output from sp into temp table
 SELECT * INTO #MyTempTable FROM OPENROWSET('SQLNCLI', 'Server=(local)\SQL2008;Trusted_Connection=yes;', 'EXEC getBusinessLineHistory')

Tuesday, March 14, 2017

SSRS Fails - Reports timeout, SSRS does not export to Excel, Reports take extremely long to run. OutofResources exception error

All of these errors are related to having some sql or ssrs function or formula that is being fed nulls.


  • Ensure that all lookup queries do not return any nulls for drop-down lookups
  • Ensure that no nulls are passed to any SQL formulas in views you are using
  • Ensure that no nulls are passed to any SSRS formulas in your report
  • Ensure that all SSRS outputs are 0 or "(none)" but never NaN or Null or Infinite
    • All nulls should be handled in SQL by ISNULL([field],0) or ISNULL([field],"(none)")
    • All nulls should be handled in SSRS by
      • =iif(isNothing(Fields!FV1.Value), Fields!FV2.Value, Fields!FV1.Value)

Saturday, March 11, 2017

LS Retail - Create a Button that prompts an Infocode

Use the INFO_K function on the button
Parameter  = Infocode Code

Dynamics GP - When running Item Check Links you get the error 'A get/change next operation on table "IV_Item_MSTR" failed. A records was already locked.'

https://www.gpug.com/communities/community-home/digestviewer/viewthread?GroupId=247&MID=30191&tab=digestviewer&CommunityKey=4754a624-39c5-4458-8105-02b65a7e929e


The IV00101.Purchase_Tax_Options field for those records is 0.
Valid values are

1 – Taxable
2 – Nontaxable
3 – Base on customer / vendor


Update all affected items and item classes accordingly to resolve the error message.


--Alternatively, you can also run this script to set all items without a purchase tax schedule to non-taxable.
--Update Items

select * from iv00101 where Purchase_Tax_options = 0

update iv00101 set Purchase_Tax_Options = 2 where Purchase_Tax_options = 0

--Also run this to update the item classes to prevent new items from starting with 0
--Update Item Classes

select * from iv40400 where Purchase_Tax_options = 0

update iv40400 set Purchase_Tax_Options = 2 where Purchase_Tax_options = 0

Friday, March 10, 2017

Dynamics GP - SQL View - SRMaster - Salesperson and Territory


CREATE VIEW [dbo].[BI_SRMaster]
AS
SELECT     dbo.RM00301.SLPRSNID, dbo.RM00303.SALSTERR, dbo.RM00303.SLTERDSC, dbo.RM00301.EMPLOYID, dbo.RM00301.SLPRSNFN, dbo.RM00301.SPRSNSLN,
                      RTRIM(dbo.RM00301.SLPRSNFN) + ' ' + RTRIM(dbo.RM00301.SPRSNSLN) AS SrNm, RTRIM(dbo.RM00301.SLPRSNID) + ' | ' + RTRIM(dbo.RM00301.SALSTERR)
                      + ' | ' + RTRIM(dbo.RM00301.SLPRSNFN) + ' ' + RTRIM(dbo.RM00301.SPRSNSLN) AS SrTerrLbl, dbo.RM00301.STATE, dbo.RM00301.INACTIVE AS SRInactive,
                      dbo.RM00303.INACTIVE AS TerrInactive
FROM         dbo.RM00301 INNER JOIN
                      dbo.RM00303 ON dbo.RM00301.SALSTERR = dbo.RM00303.SALSTERR

GO