Archives

 
SQL function to add business days

Does anyone have experience with the use of temporal tables on Great Plains tables. We have tested in a test environment and have not seen issues but I'm curious if anyone has more in depth experience with them.

We are specifically looking at applying on the following company tables

PM00200

PM00300

SY06000

Microsoft documentation is here in case it helps connect the dots to what I'm referring to - https://learn.microsoft.com/en-us/sql/relational-databases/tables/temporal-tables?view=sql-server-ver16

Error: ShipRCPTLNNM is required if the Item Number, Vendor Number, and Shipment Receipt Number exist multiple times on the shipment

I am trying to create a calculated field in smart connect that says - if the source field is blank - return empty string.

I must have a small error somewhere - been staring at it too long - what is wrong with this simple calculation?

if _Invoices = " "

then return empty.string

else return "_Invoices"

end if 

Smart Connect returns an error: system.empty is not accessible in this context because it is considered "friend"

Okay - I've been asked to create a query where the returned result is an AR Balance.

The Receivables Transactions SQL view has everything I need. However, I need to add a running Total to my query.

Since some transactions are negative amounts (credits payments returns) the traditional sum over technique doesn't work. 

Here's what I got:

select 
CAST([Document Date] as date) Date,
[Customer Number],
[Customer Name],
[Document Number],
[Accounts Receivable Account Number],
[Document Type],
Case When [Document Type] = 'Sales / Invoices' then [Original Trx Amount]
When [Document Type] = 'Debit Memos' then [Original Trx Amount]
When [Document Type] = 'Finance Charges' then [Original Trx Amount]
When [Document Type] = 'Payments' then [Original Trx Amount]*-1
When [Document Type] = 'Returns' then [Original Trx Amount]*-1
When [Document Type] = 'Credit Memos' then [Original Trx Amount]*-1
else '0' end as TransactionAmnt,
CumulativeAR=SUM([Original Trx Amount]) OVER (ORDER BY [Document Date],[Document Number]), 
[Void Status]
from ReceivablesTransactions where [Customer Number]='33855' 
and [Void Status] <> ''
ORDER BY [Document Date] ASC

CumulativeAR running total is incorrect - I need to do a running total on my calculated 'TransactionAmnt' column - rather than [Original Trx Amount]

 

Any thoughts?

Table Definition Quick Links
All Tables
SOP Tables
RM Tables
GL Tables
POP Tables
HR Tables
PM Tables
UPR Tables
IV Tables
Olympic Tables
3