Sales orders and complete line dossier — Pro
Order-date/company selection, buyer, separate order billing/shipping records, native amounts and on-demand product lines.
UNOFFICIAL — NOT VALIDATED ON A REAL ERP INSTALLATION.
For sales, customer service, warehouse coordinators and managers: choose an order-date period and company, find an order, inspect its customer reference, buyer, stored amounts and separate billing/shipping contacts and addresses. Open Order lines only when needed to see products, quantities, native units, stored prices, requested/promised dates, sites and project/task codes.
Why Cifru? Adapt configurations to the way you work. Choose the fields, filters and details you need, and bring information to your phone that may not be available in your business software’s own mobile app. Available options depend on the data exposed by your authorized source and your Cifru plan.
Pro: one SQL source, one Home button, two lists and one on-demand related button. 39 order values and 21 line values are organised in complete Details; internal keys and row tokens are hidden. Search and native opening filters are included. Each live read is bounded to 1,000 rows, without automatic refresh or preloading all lines. Identity checks can scan beyond the visible cap; a capped list is not a complete company total or a performance guarantee.
Microsoft explicitly registers SOHeader/SOLine source objects and documents company/order binding in pinned migration code. The AL logical keys are company+order and company+order+line reference. Invalid, oversized, blank or duplicated header identities reject the root read; ambiguous line identities block only their own order. Every selected parent field is checked again before reading lines; refresh the order after a source change. No RefNbr-only link, first-row fallback or silent duplicate removal.
Billing and shipping values come from this order itself, not today's Customer/SOAddress master. Type/status/company/site/terms codes remain source values. Stored Cury-prefixed amounts are shown with the parent document currency code: no ISO guarantee, conversion, signed-total formula, receivables balance, payment status or sales aggregation. Ordered, shipped and backorder quantities are separate stored fields with UnitDesc; no guessed subtraction. The opening period uses order date, not posting or requested/promised date.
Documentary and synthetic validation only: no real Dynamics SL or SQL Server installation, physical DDL, SQL types, indexes, query plan, installed owner/release or ERP roles has been verified. Map the authorised SL business database and complete the import read/compatibility test. dbo is only the proposed owner, not the system database or a Business Central migration destination. Direct SQL does not inherit ERP sessions/company ACL. Company filters and hidden keys are not access control. Use a separate administrator-scoped SELECT-only reporting login; never copy migration sysadmin/db_owner instructions.
No bank/card, source credentials, host, username/password, audit or custom/future fields are included. Screenshots use entirely fictional DEMO rows, not a live SL connection. Ordinary order contacts and commercial amounts can still be confidential. Unofficial, not Microsoft endorsed. SL is a distinct legacy installed-base product, with extended support ending July 2028; no current top-three or no-native-mobile claim.
Source registration: https://github.com/microsoft/ALAppExtensions/blob/e7ed235bc979c0283306e9639ff7cd22ce78341d/Apps/W1/HybridSL/app/src/codeunits/SLHybridWizard.Codeunit.al
Header fields: https://github.com/microsoft/ALAppExtensions/blob/e7ed235bc979c0283306e9639ff7cd22ce78341d/Apps/W1/HybridSL/app/src/Migration/SalesOrders/SLSOHeaderBuffer.Table.al
Line fields: https://github.com/microsoft/ALAppExtensions/blob/e7ed235bc979c0283306e9639ff7cd22ce78341d/Apps/W1/HybridSL/app/src/Migration/SalesOrders/SLSOLineBuffer.Table.al
Company/order binding: https://github.com/microsoft/ALAppExtensions/blob/e7ed235bc979c0283306e9639ff7cd22ce78341d/Apps/W1/HybridSL/app/src/Migration/History/SLPopulateHistTables.Codeunit.al
Screenshots
What this package creates
- Home: Sales orders
- Details: Order lines
- Sub-button: Order lines
Sources are mapped locally and verified before applying.
Custom queriesPRO2 SQL
Custom queries are a PRO feature. Cifru repeats read-only validation against the local source before execution.
$.components.workspaceSelection.datasets.0.sqlQuerySELECT RTRIM(CAST(m.CpnyID AS nvarchar(max))) AS CpnyID,RTRIM(CAST(m.OrdNbr AS nvarchar(max))) AS OrdNbr,m.OrdDate AS OrdDate,m.CustID AS CustID,m.CustOrdNbr AS CustOrdNbr,m.SOTypeID AS SOTypeID,m.Status AS Status,m.BuyerName AS BuyerName,m.CuryID AS CuryID,m.CuryTotOrd AS CuryTotOrd,m.CuryTotMerch AS CuryTotMerch,m.CuryTotTax AS CuryTotTax,m.CuryTotFrt AS CuryTotFrt,m.BillName AS BillName,m.BillAttn AS BillAttn,m.BillPhone AS BillPhone,m.BillAddr1 AS BillAddr1,m.BillAddr2 AS BillAddr2,m.BillCity AS BillCity,m.BillState AS BillState,m.BillZip AS BillZip,m.BillCountry AS BillCountry,m.ShipName AS ShipName,m.ShipAttn AS ShipAttn,m.ShipPhone AS ShipPhone,m.ShipAddr1 AS ShipAddr1,m.ShipAddr2 AS ShipAddr2,m.ShipCity AS ShipCity,m.ShipState AS ShipState,m.ShipZip AS ShipZip,m.ShipCountry AS ShipCountry,m.ShiptoID AS ShiptoID,m.ShipViaID AS ShipViaID,m.ShipSiteID AS ShipSiteID,m.TermsID AS TermsID,m.SlsperID AS SlsperID,m.ProjectID AS ProjectID,CONCAT(CASE WHEN RTRIM(CAST(m.CpnyID AS nvarchar(max))) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(RTRIM(CAST(m.CpnyID AS nvarchar(max))) AS nvarchar(max))),N':',CAST(RTRIM(CAST(m.CpnyID AS nvarchar(max))) AS nvarchar(max)),N';') END,CASE WHEN RTRIM(CAST(m.OrdNbr AS nvarchar(max))) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(RTRIM(CAST(m.OrdNbr AS nvarchar(max))) AS nvarchar(max))),N':',CAST(RTRIM(CAST(m.OrdNbr AS nvarchar(max))) AS nvarchar(max)),N';') END) AS OrderKey,CONCAT(CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.CpnyID),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CpnyID),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CpnyID),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.OrdNbr),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.OrdNbr),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.OrdNbr),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.OrdDate),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.OrdDate),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.OrdDate),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.CustID),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CustID),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CustID),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.CustOrdNbr),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CustOrdNbr),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CustOrdNbr),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.SOTypeID),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.SOTypeID),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.SOTypeID),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.Status),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.Status),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.Status),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.BuyerName),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BuyerName),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BuyerName),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryID),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryID),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryID),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotOrd),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotOrd),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotOrd),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotMerch),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotMerch),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotMerch),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotTax),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotTax),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotTax),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotFrt),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotFrt),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotFrt),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.BillName),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillName),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillName),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.BillAttn),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillAttn),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillAttn),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.BillPhone),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillPhone),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillPhone),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.BillAddr1),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillAddr1),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillAddr1),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.BillAddr2),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillAddr2),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillAddr2),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.BillCity),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillCity),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillCity),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.BillState),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillState),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillState),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.BillZip),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillZip),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillZip),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.BillCountry),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillCountry),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillCountry),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipName),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipName),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipName),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipAttn),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipAttn),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipAttn),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipPhone),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipPhone),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipPhone),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipAddr1),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipAddr1),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipAddr1),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipAddr2),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipAddr2),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipAddr2),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipCity),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipCity),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipCity),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipState),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipState),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipState),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipZip),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipZip),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipZip),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipCountry),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipCountry),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipCountry),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShiptoID),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShiptoID),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShiptoID),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipViaID),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipViaID),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipViaID),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipSiteID),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipSiteID),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipSiteID),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.TermsID),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.TermsID),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.TermsID),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.SlsperID),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.SlsperID),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.SlsperID),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ProjectID),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ProjectID),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ProjectID),2) AS nvarchar(max)),N';') END) AS OrderContext,CASE WHEN NOT (NOT EXISTS (SELECT 1 FROM dbo.SOLine bad WHERE (RTRIM(CAST(bad.CpnyID AS nvarchar(max))) COLLATE Latin1_General_100_BIN2=RTRIM(CAST(m.CpnyID AS nvarchar(max))) COLLATE Latin1_General_100_BIN2 AND DATALENGTH(RTRIM(CAST(bad.CpnyID AS nvarchar(max))))=DATALENGTH(RTRIM(CAST(m.CpnyID AS nvarchar(max))))) AND (RTRIM(CAST(bad.OrdNbr AS nvarchar(max))) COLLATE Latin1_General_100_BIN2=RTRIM(CAST(m.OrdNbr AS nvarchar(max))) COLLATE Latin1_General_100_BIN2 AND DATALENGTH(RTRIM(CAST(bad.OrdNbr AS nvarchar(max))))=DATALENGTH(RTRIM(CAST(m.OrdNbr AS nvarchar(max))))) AND ((bad.CpnyID IS NULL OR RTRIM(CAST(bad.CpnyID AS nvarchar(max)))=N'' OR DATALENGTH(RTRIM(CAST(bad.CpnyID AS nvarchar(max))))>20) OR (bad.OrdNbr IS NULL OR RTRIM(CAST(bad.OrdNbr AS nvarchar(max)))=N'' OR DATALENGTH(RTRIM(CAST(bad.OrdNbr AS nvarchar(max))))>30) OR (bad.LineRef IS NULL OR RTRIM(CAST(bad.LineRef AS nvarchar(max)))=N'' OR DATALENGTH(RTRIM(CAST(bad.LineRef AS nvarchar(max))))>10))) AND NOT EXISTS (SELECT 1 FROM dbo.SOLine bad WHERE (RTRIM(CAST(bad.CpnyID AS nvarchar(max))) COLLATE Latin1_General_100_BIN2=RTRIM(CAST(m.CpnyID AS nvarchar(max))) COLLATE Latin1_General_100_BIN2 AND DATALENGTH(RTRIM(CAST(bad.CpnyID AS nvarchar(max))))=DATALENGTH(RTRIM(CAST(m.CpnyID AS nvarchar(max))))) AND (RTRIM(CAST(bad.OrdNbr AS nvarchar(max))) COLLATE Latin1_General_100_BIN2=RTRIM(CAST(m.OrdNbr AS nvarchar(max))) COLLATE Latin1_General_100_BIN2 AND DATALENGTH(RTRIM(CAST(bad.OrdNbr AS nvarchar(max))))=DATALENGTH(RTRIM(CAST(m.OrdNbr AS nvarchar(max))))) GROUP BY CAST(RTRIM(CAST(bad.LineRef AS nvarchar(max))) AS nvarchar(5)) COLLATE Latin1_General_100_BIN2,DATALENGTH(RTRIM(CAST(bad.LineRef AS nvarchar(max)))) HAVING COUNT(1)<>1)) THEN N'Ambiguous / invalid line references' WHEN EXISTS (SELECT 1 FROM dbo.SOLine a WHERE (RTRIM(CAST(a.CpnyID AS nvarchar(max))) COLLATE Latin1_General_100_BIN2=RTRIM(CAST(m.CpnyID AS nvarchar(max))) COLLATE Latin1_General_100_BIN2 AND DATALENGTH(RTRIM(CAST(a.CpnyID AS nvarchar(max))))=DATALENGTH(RTRIM(CAST(m.CpnyID AS nvarchar(max))))) AND (RTRIM(CAST(a.OrdNbr AS nvarchar(max))) COLLATE Latin1_General_100_BIN2=RTRIM(CAST(m.OrdNbr AS nvarchar(max))) COLLATE Latin1_General_100_BIN2 AND DATALENGTH(RTRIM(CAST(a.OrdNbr AS nvarchar(max))))=DATALENGTH(RTRIM(CAST(m.OrdNbr AS nvarchar(max)))))) THEN N'Available on demand' ELSE N'No stored lines' END AS LineAvailability,N'Stored order, billing and shipping record; not an invoice or current customer master' AS OrderScope FROM dbo.SOHeader m WHERE NOT EXISTS (SELECT 1 FROM dbo.SOHeader bad WHERE (bad.CpnyID IS NULL OR RTRIM(CAST(bad.CpnyID AS nvarchar(max)))=N'' OR DATALENGTH(RTRIM(CAST(bad.CpnyID AS nvarchar(max))))>20) OR (bad.OrdNbr IS NULL OR RTRIM(CAST(bad.OrdNbr AS nvarchar(max)))=N'' OR DATALENGTH(RTRIM(CAST(bad.OrdNbr AS nvarchar(max))))>30)) AND NOT EXISTS (SELECT 1 FROM dbo.SOHeader bad GROUP BY CAST(RTRIM(CAST(bad.CpnyID AS nvarchar(max))) AS nvarchar(10)) COLLATE Latin1_General_100_BIN2,DATALENGTH(RTRIM(CAST(bad.CpnyID AS nvarchar(max)))),CAST(RTRIM(CAST(bad.OrdNbr AS nvarchar(max))) AS nvarchar(15)) COLLATE Latin1_General_100_BIN2,DATALENGTH(RTRIM(CAST(bad.OrdNbr AS nvarchar(max)))) HAVING COUNT(1)<>1)
static read-only checks passed
$.components.workspaceSelection.datasets.1.sqlQuerySELECT RTRIM(CAST(a.CpnyID AS nvarchar(max))) AS CpnyID,RTRIM(CAST(a.OrdNbr AS nvarchar(max))) AS OrdNbr,RTRIM(CAST(a.LineRef AS nvarchar(max))) AS LineRef,a.LineNbr AS LineNbr,a.InvtID AS InvtID,a.Descr AS Descr,a.QtyOrd AS QtyOrd,a.QtyShip AS QtyShip,a.QtyBO AS QtyBO,a.UnitDesc AS UnitDesc,a.CurySlsPrice AS CurySlsPrice,a.CuryTotOrd AS CuryTotOrd,a.SiteID AS SiteID,a.PromDate AS PromDate,a.ReqDate AS ReqDate,a.Status AS Status,a.ProjectID AS ProjectID,a.TaskID AS TaskID,CONCAT(CASE WHEN RTRIM(CAST(a.CpnyID AS nvarchar(max))) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(RTRIM(CAST(a.CpnyID AS nvarchar(max))) AS nvarchar(max))),N':',CAST(RTRIM(CAST(a.CpnyID AS nvarchar(max))) AS nvarchar(max)),N';') END,CASE WHEN RTRIM(CAST(a.OrdNbr AS nvarchar(max))) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(RTRIM(CAST(a.OrdNbr AS nvarchar(max))) AS nvarchar(max))),N':',CAST(RTRIM(CAST(a.OrdNbr AS nvarchar(max))) AS nvarchar(max)),N';') END,CASE WHEN RTRIM(CAST(a.LineRef AS nvarchar(max))) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(RTRIM(CAST(a.LineRef AS nvarchar(max))) AS nvarchar(max))),N':',CAST(RTRIM(CAST(a.LineRef AS nvarchar(max))) AS nvarchar(max)),N';') END) AS LineKey,CONCAT(CASE WHEN RTRIM(CAST(a.CpnyID AS nvarchar(max))) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(RTRIM(CAST(a.CpnyID AS nvarchar(max))) AS nvarchar(max))),N':',CAST(RTRIM(CAST(a.CpnyID AS nvarchar(max))) AS nvarchar(max)),N';') END,CASE WHEN RTRIM(CAST(a.OrdNbr AS nvarchar(max))) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(RTRIM(CAST(a.OrdNbr AS nvarchar(max))) AS nvarchar(max))),N':',CAST(RTRIM(CAST(a.OrdNbr AS nvarchar(max))) AS nvarchar(max)),N';') END) AS OrderKey,:orderContext AS OrderContext,m.CuryID AS DocumentCurrency,m.CustID AS DocumentCustomer,N'Separate stored quantities and source Cury values; no converted or calculated outstanding total' AS LineScope FROM dbo.SOLine a INNER JOIN dbo.SOHeader m ON (RTRIM(CAST(m.CpnyID AS nvarchar(max))) COLLATE Latin1_General_100_BIN2=RTRIM(CAST(a.CpnyID AS nvarchar(max))) COLLATE Latin1_General_100_BIN2 AND DATALENGTH(RTRIM(CAST(m.CpnyID AS nvarchar(max))))=DATALENGTH(RTRIM(CAST(a.CpnyID AS nvarchar(max))))) AND (RTRIM(CAST(m.OrdNbr AS nvarchar(max))) COLLATE Latin1_General_100_BIN2=RTRIM(CAST(a.OrdNbr AS nvarchar(max))) COLLATE Latin1_General_100_BIN2 AND DATALENGTH(RTRIM(CAST(m.OrdNbr AS nvarchar(max))))=DATALENGTH(RTRIM(CAST(a.OrdNbr AS nvarchar(max))))) WHERE (RTRIM(CAST(a.CpnyID AS nvarchar(max))) COLLATE Latin1_General_100_BIN2=RTRIM(CAST(:company AS nvarchar(max))) COLLATE Latin1_General_100_BIN2 AND DATALENGTH(RTRIM(CAST(a.CpnyID AS nvarchar(max))))=DATALENGTH(RTRIM(CAST(:company AS nvarchar(max))))) AND (RTRIM(CAST(a.OrdNbr AS nvarchar(max))) COLLATE Latin1_General_100_BIN2=RTRIM(CAST(:order AS nvarchar(max))) COLLATE Latin1_General_100_BIN2 AND DATALENGTH(RTRIM(CAST(a.OrdNbr AS nvarchar(max))))=DATALENGTH(RTRIM(CAST(:order AS nvarchar(max))))) AND NOT EXISTS (SELECT 1 FROM dbo.SOHeader bad WHERE (bad.CpnyID IS NULL OR RTRIM(CAST(bad.CpnyID AS nvarchar(max)))=N'' OR DATALENGTH(RTRIM(CAST(bad.CpnyID AS nvarchar(max))))>20) OR (bad.OrdNbr IS NULL OR RTRIM(CAST(bad.OrdNbr AS nvarchar(max)))=N'' OR DATALENGTH(RTRIM(CAST(bad.OrdNbr AS nvarchar(max))))>30)) AND NOT EXISTS (SELECT 1 FROM dbo.SOHeader bad GROUP BY CAST(RTRIM(CAST(bad.CpnyID AS nvarchar(max))) AS nvarchar(10)) COLLATE Latin1_General_100_BIN2,DATALENGTH(RTRIM(CAST(bad.CpnyID AS nvarchar(max)))),CAST(RTRIM(CAST(bad.OrdNbr AS nvarchar(max))) AS nvarchar(15)) COLLATE Latin1_General_100_BIN2,DATALENGTH(RTRIM(CAST(bad.OrdNbr AS nvarchar(max)))) HAVING COUNT(1)<>1) AND NOT EXISTS (SELECT 1 FROM dbo.SOLine bad WHERE (RTRIM(CAST(bad.CpnyID AS nvarchar(max))) COLLATE Latin1_General_100_BIN2=RTRIM(CAST(:company AS nvarchar(max))) COLLATE Latin1_General_100_BIN2 AND DATALENGTH(RTRIM(CAST(bad.CpnyID AS nvarchar(max))))=DATALENGTH(RTRIM(CAST(:company AS nvarchar(max))))) AND (RTRIM(CAST(bad.OrdNbr AS nvarchar(max))) COLLATE Latin1_General_100_BIN2=RTRIM(CAST(:order AS nvarchar(max))) COLLATE Latin1_General_100_BIN2 AND DATALENGTH(RTRIM(CAST(bad.OrdNbr AS nvarchar(max))))=DATALENGTH(RTRIM(CAST(:order AS nvarchar(max))))) AND ((bad.CpnyID IS NULL OR RTRIM(CAST(bad.CpnyID AS nvarchar(max)))=N'' OR DATALENGTH(RTRIM(CAST(bad.CpnyID AS nvarchar(max))))>20) OR (bad.OrdNbr IS NULL OR RTRIM(CAST(bad.OrdNbr AS nvarchar(max)))=N'' OR DATALENGTH(RTRIM(CAST(bad.OrdNbr AS nvarchar(max))))>30) OR (bad.LineRef IS NULL OR RTRIM(CAST(bad.LineRef AS nvarchar(max)))=N'' OR DATALENGTH(RTRIM(CAST(bad.LineRef AS nvarchar(max))))>10))) AND NOT EXISTS (SELECT 1 FROM dbo.SOLine bad WHERE (RTRIM(CAST(bad.CpnyID AS nvarchar(max))) COLLATE Latin1_General_100_BIN2=RTRIM(CAST(:company AS nvarchar(max))) COLLATE Latin1_General_100_BIN2 AND DATALENGTH(RTRIM(CAST(bad.CpnyID AS nvarchar(max))))=DATALENGTH(RTRIM(CAST(:company AS nvarchar(max))))) AND (RTRIM(CAST(bad.OrdNbr AS nvarchar(max))) COLLATE Latin1_General_100_BIN2=RTRIM(CAST(:order AS nvarchar(max))) COLLATE Latin1_General_100_BIN2 AND DATALENGTH(RTRIM(CAST(bad.OrdNbr AS nvarchar(max))))=DATALENGTH(RTRIM(CAST(:order AS nvarchar(max))))) GROUP BY CAST(RTRIM(CAST(bad.LineRef AS nvarchar(max))) AS nvarchar(5)) COLLATE Latin1_General_100_BIN2,DATALENGTH(RTRIM(CAST(bad.LineRef AS nvarchar(max)))) HAVING COUNT(1)<>1) AND (CONCAT(CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.CpnyID),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CpnyID),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CpnyID),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.OrdNbr),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.OrdNbr),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.OrdNbr),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.OrdDate),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.OrdDate),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.OrdDate),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.CustID),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CustID),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CustID),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.CustOrdNbr),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CustOrdNbr),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CustOrdNbr),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.SOTypeID),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.SOTypeID),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.SOTypeID),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.Status),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.Status),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.Status),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.BuyerName),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BuyerName),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BuyerName),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryID),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryID),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryID),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotOrd),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotOrd),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotOrd),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotMerch),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotMerch),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotMerch),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotTax),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotTax),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotTax),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotFrt),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotFrt),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotFrt),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.BillName),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillName),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillName),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.BillAttn),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillAttn),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillAttn),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.BillPhone),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillPhone),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillPhone),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.BillAddr1),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillAddr1),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillAddr1),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.BillAddr2),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillAddr2),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillAddr2),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.BillCity),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillCity),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillCity),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.BillState),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillState),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillState),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.BillZip),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillZip),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillZip),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.BillCountry),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillCountry),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillCountry),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipName),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipName),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipName),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipAttn),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipAttn),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipAttn),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipPhone),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipPhone),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipPhone),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipAddr1),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipAddr1),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipAddr1),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipAddr2),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipAddr2),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipAddr2),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipCity),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipCity),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipCity),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipState),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipState),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipState),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipZip),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipZip),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipZip),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipCountry),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipCountry),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipCountry),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShiptoID),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShiptoID),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShiptoID),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipViaID),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipViaID),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipViaID),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipSiteID),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipSiteID),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipSiteID),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.TermsID),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.TermsID),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.TermsID),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.SlsperID),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.SlsperID),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.SlsperID),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ProjectID),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ProjectID),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ProjectID),2) AS nvarchar(max)),N';') END) COLLATE Latin1_General_100_BIN2=:orderContext COLLATE Latin1_General_100_BIN2 AND DATALENGTH(CONCAT(CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.CpnyID),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CpnyID),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CpnyID),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.OrdNbr),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.OrdNbr),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.OrdNbr),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.OrdDate),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.OrdDate),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.OrdDate),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.CustID),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CustID),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CustID),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.CustOrdNbr),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CustOrdNbr),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CustOrdNbr),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.SOTypeID),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.SOTypeID),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.SOTypeID),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.Status),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.Status),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.Status),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.BuyerName),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BuyerName),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BuyerName),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryID),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryID),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryID),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotOrd),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotOrd),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotOrd),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotMerch),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotMerch),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotMerch),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotTax),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotTax),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotTax),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotFrt),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotFrt),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotFrt),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.BillName),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillName),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillName),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.BillAttn),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillAttn),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillAttn),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.BillPhone),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillPhone),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillPhone),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.BillAddr1),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillAddr1),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillAddr1),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.BillAddr2),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillAddr2),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillAddr2),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.BillCity),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillCity),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillCity),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.BillState),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillState),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillState),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.BillZip),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillZip),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillZip),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.BillCountry),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillCountry),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillCountry),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipName),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipName),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipName),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipAttn),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipAttn),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipAttn),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipPhone),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipPhone),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipPhone),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipAddr1),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipAddr1),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipAddr1),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipAddr2),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipAddr2),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipAddr2),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipCity),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipCity),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipCity),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipState),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipState),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipState),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipZip),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipZip),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipZip),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipCountry),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipCountry),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipCountry),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShiptoID),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShiptoID),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShiptoID),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipViaID),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipViaID),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipViaID),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipSiteID),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipSiteID),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipSiteID),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.TermsID),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.TermsID),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.TermsID),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.SlsperID),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.SlsperID),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.SlsperID),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ProjectID),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ProjectID),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ProjectID),2) AS nvarchar(max)),N';') END))=DATALENGTH(:orderContext))
static read-only checks passed
View the JSON being importedcollapsed by default
{
"components": {
"sourceSlots": [
{
"displayName": "Dynamics SL — authorised SQL business database",
"id": "7158F496-3450-55CC-81C8-3094B1D702A6",
"kind": "sqlServer",
"requiredObjects": [
"dbo.SOHeader",
"dbo.SOLine"
],
"requiresCustomSQL": false
}
],
"workspaceSelection": {
"commonFields": [],
"datasets": [
{
"cacheMode": "live",
"calculatedFields": [],
"customQueryIntegrationName": "",
"endpointPath": "",
"fetchSortRules": [
{
"direction": "descending",
"id": "1818BCCF-34E2-5074-B231-2555B6895775",
"key": "OrdDate",
"type": "date"
},
{
"direction": "ascending",
"id": "995FEE5B-187A-5A70-BA4C-6AAAE9E26915",
"key": "OrdNbr",
"type": "text"
},
{
"direction": "ascending",
"id": "E6DC6CBA-8DAF-5077-A998-3D2DE4004901",
"key": "OrderKey",
"type": "text"
}
],
"id": "52A34698-0276-5ABD-BA27-240717E0F426",
"mappings": [
{
"commonFieldKey": "",
"key": "OrderKey",
"label": "Internal complete order context",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "OrderKey",
"type": "text",
"visibleInDetail": false,
"visibleInList": false
},
{
"commonFieldKey": "",
"key": "OrderContext",
"label": "Internal complete order context",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "OrderContext",
"type": "text",
"visibleInDetail": false,
"visibleInList": false
},
{
"commonFieldKey": "",
"key": "CpnyID",
"label": "Stored company code",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "CpnyID",
"type": "text",
"visibleInDetail": true,
"visibleInList": true
},
{
"commonFieldKey": "",
"key": "OrdNbr",
"label": "Order number",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "OrdNbr",
"type": "text",
"visibleInDetail": true,
"visibleInList": false
},
{
"commonFieldKey": "",
"key": "OrdDate",
"label": "Stored order date",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "OrdDate",
"type": "date",
"visibleInDetail": true,
"visibleInList": true
},
{
"commonFieldKey": "",
"key": "CustID",
"label": "Customer business code",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "CustID",
"type": "text",
"visibleInDetail": true,
"visibleInList": true
},
{
"commonFieldKey": "",
"key": "CustOrdNbr",
"label": "Customer order reference",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "CustOrdNbr",
"type": "text",
"visibleInDetail": true,
"visibleInList": false
},
{
"commonFieldKey": "",
"key": "SOTypeID",
"label": "Stored order type code",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "SOTypeID",
"type": "text",
"visibleInDetail": true,
"visibleInList": false
},
{
"commonFieldKey": "",
"key": "Status",
"label": "Stored order status code",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "Status",
"type": "text",
"visibleInDetail": true,
"visibleInList": true
},
{
"commonFieldKey": "",
"key": "BuyerName",
"label": "Buyer name",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "BuyerName",
"type": "text",
"visibleInDetail": true,
"visibleInList": true
},
{
"commonFieldKey": "",
"key": "CuryID",
"label": "Stored document currency code",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "CuryID",
"type": "text",
"visibleInDetail": true,
"visibleInList": true
},
{
"commonFieldKey": "",
"key": "CuryTotOrd",
"label": "Stored order amount — document currency",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "CuryTotOrd",
"type": "number",
"visibleInDetail": true,
"visibleInList": true
},
{
"commonFieldKey": "",
"key": "CuryTotMerch",
"label": "Stored merchandise amount — document currency",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "CuryTotMerch",
"type": "number",
"visibleInDetail": true,
"visibleInList": false
},
{
"commonFieldKey": "",
"key": "CuryTotTax",
"label": "Stored tax amount — document currency",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "CuryTotTax",
"type": "number",
"visibleInDetail": true,
"visibleInList": false
},
{
"commonFieldKey": "",
"key": "CuryTotFrt",
"label": "Stored freight amount — document currency",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "CuryTotFrt",
"type": "number",
"visibleInDetail": true,
"visibleInList": false
},
{
"commonFieldKey": "",
"key": "BillName",
"label": "Order billing name",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "BillName",
"type": "text",
"visibleInDetail": true,
"visibleInList": false
},
{
"commonFieldKey": "",
"key": "BillAttn",
"label": "Order billing contact",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "BillAttn",
"type": "text",
"visibleInDetail": true,
"visibleInList": false
},
{
"commonFieldKey": "",
"key": "BillPhone",
"label": "Order billing phone",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "BillPhone",
"type": "text",
"visibleInDetail": true,
"visibleInList": false
},
{
"commonFieldKey": "",
"key": "BillAddr1",
"label": "Order billing address line 1",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "BillAddr1",
"type": "text",
"visibleInDetail": true,
"visibleInList": false
},
{
"commonFieldKey": "",
"key": "BillAddr2",
"label": "Order billing address line 2",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "BillAddr2",
"type": "text",
"visibleInDetail": true,
"visibleInList": false
},
{
"commonFieldKey": "",
"key": "BillCity",
"label": "Order billing city",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "BillCity",
"type": "text",
"visibleInDetail": true,
"visibleInList": false
},
{
"commonFieldKey": "",
"key": "BillState",
"label": "Order billing state / region",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "BillState",
"type": "text",
"visibleInDetail": true,
"visibleInList": false
},
{
"commonFieldKey": "",
"key": "BillZip",
"label": "Order billing postal code",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "BillZip",
"type": "text",
"visibleInDetail": true,
"visibleInList": false
},
{
"commonFieldKey": "",
"key": "BillCountry",
"label": "Order billing country code",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "BillCountry",
"type": "text",
"visibleInDetail": true,
"visibleInList": false
},
{
"commonFieldKey": "",
"key": "ShipName",
"label": "Order shipping name",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "ShipName",
"type": "text",
"visibleInDetail": true,
"visibleInList": false
},
{
"commonFieldKey": "",
"key": "ShipAttn",
"label": "Order shipping contact",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "ShipAttn",
"type": "text",
"visibleInDetail": true,
"visibleInList": false
},
{
"commonFieldKey": "",
"key": "ShipPhone",
"label": "Order shipping phone",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "ShipPhone",
"type": "text",
"visibleInDetail": true,
"visibleInList": false
},
{
"commonFieldKey": "",
"key": "ShipAddr1",
"label": "Order shipping address line 1",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "ShipAddr1",
"type": "text",
"visibleInDetail": true,
"visibleInList": false
},
{
"commonFieldKey": "",
"key": "ShipAddr2",
"label": "Order shipping address line 2",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "ShipAddr2",
"type": "text",
"visibleInDetail": true,
"visibleInList": false
},
{
"commonFieldKey": "",
"key": "ShipCity",
"label": "Order shipping city",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "ShipCity",
"type": "text",
"visibleInDetail": true,
"visibleInList": false
},
{
"commonFieldKey": "",
"key": "ShipState",
"label": "Order shipping state / region",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "ShipState",
"type": "text",
"visibleInDetail": true,
"visibleInList": false
},
{
"commonFieldKey": "",
"key": "ShipZip",
"label": "Order shipping postal code",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "ShipZip",
"type": "text",
"visibleInDetail": true,
"visibleInList": false
},
{
"commonFieldKey": "",
"key": "ShipCountry",
"label": "Order shipping country code",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "ShipCountry",
"type": "text",
"visibleInDetail": true,
"visibleInList": false
},
{
"commonFieldKey": "",
"key": "ShiptoID",
"label": "Stored ship-to business code",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "ShiptoID",
"type": "text",
"visibleInDetail": true,
"visibleInList": false
},
{
"commonFieldKey": "",
"key": "ShipViaID",
"label": "Stored shipping method code",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "ShipViaID",
"type": "text",
"visibleInDetail": true,
"visibleInList": false
},
{
"commonFieldKey": "",
"key": "ShipSiteID",
"label": "Stored shipping site code",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "ShipSiteID",
"type": "text",
"visibleInDetail": true,
"visibleInList": false
},
{
"commonFieldKey": "",
"key": "TermsID",
"label": "Stored payment terms code",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "TermsID",
"type": "text",
"visibleInDetail": true,
"visibleInList": false
},
{
"commonFieldKey": "",
"key": "SlsperID",
"label": "Stored salesperson code",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "SlsperID",
"type": "text",
"visibleInDetail": true,
"visibleInList": false
},
{
"commonFieldKey": "",
"key": "ProjectID",
"label": "Stored project code",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "ProjectID",
"type": "text",
"visibleInDetail": true,
"visibleInList": false
},
{
"commonFieldKey": "",
"key": "LineAvailability",
"label": "Order-line identity availability",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "LineAvailability",
"type": "text",
"visibleInDetail": true,
"visibleInList": true
},
{
"commonFieldKey": "",
"key": "OrderScope",
"label": "Order record scope",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "OrderScope",
"type": "text",
"visibleInDetail": true,
"visibleInList": false
}
],
"maxRows": 1000,
"name": "Sales orders",
"primaryKey": "OrderKey",
"queryParameters": [],
"refreshPolicy": {
"enabled": false,
"intervalMinutes": 60
},
"rootArrayPath": "",
"rowLimitEnabled": true,
"searchKeys": [
"CpnyID",
"OrdNbr",
"OrdDate",
"CustID",
"CustOrdNbr",
"SOTypeID",
"Status",
"BuyerName",
"CuryID",
"CuryTotOrd",
"CuryTotMerch",
"CuryTotTax",
"CuryTotFrt",
"BillName",
"BillAttn",
"BillPhone",
"BillAddr1",
"BillAddr2",
"BillCity",
"BillState",
"BillZip",
"BillCountry",
"ShipName",
"ShipAttn",
"ShipPhone",
"ShipAddr1",
"ShipAddr2",
"ShipCity",
"ShipState",
"ShipZip",
"ShipCountry",
"ShiptoID",
"ShipViaID",
"ShipSiteID",
"TermsID",
"SlsperID",
"ProjectID",
"LineAvailability",
"OrderScope"
],
"sourceID": "7158F496-3450-55CC-81C8-3094B1D702A6",
"sqlQuery": "SELECT RTRIM(CAST(m.CpnyID AS nvarchar(max))) AS CpnyID,RTRIM(CAST(m.OrdNbr AS nvarchar(max))) AS OrdNbr,m.OrdDate AS OrdDate,m.CustID AS CustID,m.CustOrdNbr AS CustOrdNbr,m.SOTypeID AS SOTypeID,m.Status AS Status,m.BuyerName AS BuyerName,m.CuryID AS CuryID,m.CuryTotOrd AS CuryTotOrd,m.CuryTotMerch AS CuryTotMerch,m.CuryTotTax AS CuryTotTax,m.CuryTotFrt AS CuryTotFrt,m.BillName AS BillName,m.BillAttn AS BillAttn,m.BillPhone AS BillPhone,m.BillAddr1 AS BillAddr1,m.BillAddr2 AS BillAddr2,m.BillCity AS BillCity,m.BillState AS BillState,m.BillZip AS BillZip,m.BillCountry AS BillCountry,m.ShipName AS ShipName,m.ShipAttn AS ShipAttn,m.ShipPhone AS ShipPhone,m.ShipAddr1 AS ShipAddr1,m.ShipAddr2 AS ShipAddr2,m.ShipCity AS ShipCity,m.ShipState AS ShipState,m.ShipZip AS ShipZip,m.ShipCountry AS ShipCountry,m.ShiptoID AS ShiptoID,m.ShipViaID AS ShipViaID,m.ShipSiteID AS ShipSiteID,m.TermsID AS TermsID,m.SlsperID AS SlsperID,m.ProjectID AS ProjectID,CONCAT(CASE WHEN RTRIM(CAST(m.CpnyID AS nvarchar(max))) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(RTRIM(CAST(m.CpnyID AS nvarchar(max))) AS nvarchar(max))),N':',CAST(RTRIM(CAST(m.CpnyID AS nvarchar(max))) AS nvarchar(max)),N';') END,CASE WHEN RTRIM(CAST(m.OrdNbr AS nvarchar(max))) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(RTRIM(CAST(m.OrdNbr AS nvarchar(max))) AS nvarchar(max))),N':',CAST(RTRIM(CAST(m.OrdNbr AS nvarchar(max))) AS nvarchar(max)),N';') END) AS OrderKey,CONCAT(CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.CpnyID),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CpnyID),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CpnyID),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.OrdNbr),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.OrdNbr),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.OrdNbr),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.OrdDate),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.OrdDate),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.OrdDate),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.CustID),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CustID),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CustID),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.CustOrdNbr),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CustOrdNbr),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CustOrdNbr),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.SOTypeID),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.SOTypeID),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.SOTypeID),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.Status),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.Status),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.Status),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.BuyerName),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BuyerName),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BuyerName),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryID),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryID),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryID),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotOrd),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotOrd),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotOrd),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotMerch),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotMerch),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotMerch),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotTax),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotTax),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotTax),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotFrt),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotFrt),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotFrt),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.BillName),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillName),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillName),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.BillAttn),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillAttn),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillAttn),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.BillPhone),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillPhone),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillPhone),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.BillAddr1),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillAddr1),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillAddr1),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.BillAddr2),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillAddr2),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillAddr2),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.BillCity),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillCity),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillCity),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.BillState),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillState),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillState),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.BillZip),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillZip),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillZip),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.BillCountry),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillCountry),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillCountry),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipName),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipName),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipName),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipAttn),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipAttn),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipAttn),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipPhone),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipPhone),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipPhone),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipAddr1),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipAddr1),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipAddr1),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipAddr2),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipAddr2),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipAddr2),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipCity),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipCity),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipCity),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipState),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipState),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipState),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipZip),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipZip),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipZip),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipCountry),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipCountry),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipCountry),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShiptoID),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShiptoID),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShiptoID),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipViaID),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipViaID),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipViaID),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipSiteID),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipSiteID),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipSiteID),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.TermsID),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.TermsID),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.TermsID),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.SlsperID),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.SlsperID),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.SlsperID),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ProjectID),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ProjectID),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ProjectID),2) AS nvarchar(max)),N';') END) AS OrderContext,CASE WHEN NOT (NOT EXISTS (SELECT 1 FROM dbo.SOLine bad WHERE (RTRIM(CAST(bad.CpnyID AS nvarchar(max))) COLLATE Latin1_General_100_BIN2=RTRIM(CAST(m.CpnyID AS nvarchar(max))) COLLATE Latin1_General_100_BIN2 AND DATALENGTH(RTRIM(CAST(bad.CpnyID AS nvarchar(max))))=DATALENGTH(RTRIM(CAST(m.CpnyID AS nvarchar(max))))) AND (RTRIM(CAST(bad.OrdNbr AS nvarchar(max))) COLLATE Latin1_General_100_BIN2=RTRIM(CAST(m.OrdNbr AS nvarchar(max))) COLLATE Latin1_General_100_BIN2 AND DATALENGTH(RTRIM(CAST(bad.OrdNbr AS nvarchar(max))))=DATALENGTH(RTRIM(CAST(m.OrdNbr AS nvarchar(max))))) AND ((bad.CpnyID IS NULL OR RTRIM(CAST(bad.CpnyID AS nvarchar(max)))=N'' OR DATALENGTH(RTRIM(CAST(bad.CpnyID AS nvarchar(max))))>20) OR (bad.OrdNbr IS NULL OR RTRIM(CAST(bad.OrdNbr AS nvarchar(max)))=N'' OR DATALENGTH(RTRIM(CAST(bad.OrdNbr AS nvarchar(max))))>30) OR (bad.LineRef IS NULL OR RTRIM(CAST(bad.LineRef AS nvarchar(max)))=N'' OR DATALENGTH(RTRIM(CAST(bad.LineRef AS nvarchar(max))))>10))) AND NOT EXISTS (SELECT 1 FROM dbo.SOLine bad WHERE (RTRIM(CAST(bad.CpnyID AS nvarchar(max))) COLLATE Latin1_General_100_BIN2=RTRIM(CAST(m.CpnyID AS nvarchar(max))) COLLATE Latin1_General_100_BIN2 AND DATALENGTH(RTRIM(CAST(bad.CpnyID AS nvarchar(max))))=DATALENGTH(RTRIM(CAST(m.CpnyID AS nvarchar(max))))) AND (RTRIM(CAST(bad.OrdNbr AS nvarchar(max))) COLLATE Latin1_General_100_BIN2=RTRIM(CAST(m.OrdNbr AS nvarchar(max))) COLLATE Latin1_General_100_BIN2 AND DATALENGTH(RTRIM(CAST(bad.OrdNbr AS nvarchar(max))))=DATALENGTH(RTRIM(CAST(m.OrdNbr AS nvarchar(max))))) GROUP BY CAST(RTRIM(CAST(bad.LineRef AS nvarchar(max))) AS nvarchar(5)) COLLATE Latin1_General_100_BIN2,DATALENGTH(RTRIM(CAST(bad.LineRef AS nvarchar(max)))) HAVING COUNT(1)<>1)) THEN N'Ambiguous / invalid line references' WHEN EXISTS (SELECT 1 FROM dbo.SOLine a WHERE (RTRIM(CAST(a.CpnyID AS nvarchar(max))) COLLATE Latin1_General_100_BIN2=RTRIM(CAST(m.CpnyID AS nvarchar(max))) COLLATE Latin1_General_100_BIN2 AND DATALENGTH(RTRIM(CAST(a.CpnyID AS nvarchar(max))))=DATALENGTH(RTRIM(CAST(m.CpnyID AS nvarchar(max))))) AND (RTRIM(CAST(a.OrdNbr AS nvarchar(max))) COLLATE Latin1_General_100_BIN2=RTRIM(CAST(m.OrdNbr AS nvarchar(max))) COLLATE Latin1_General_100_BIN2 AND DATALENGTH(RTRIM(CAST(a.OrdNbr AS nvarchar(max))))=DATALENGTH(RTRIM(CAST(m.OrdNbr AS nvarchar(max)))))) THEN N'Available on demand' ELSE N'No stored lines' END AS LineAvailability,N'Stored order, billing and shipping record; not an invoice or current customer master' AS OrderScope FROM dbo.SOHeader m WHERE NOT EXISTS (SELECT 1 FROM dbo.SOHeader bad WHERE (bad.CpnyID IS NULL OR RTRIM(CAST(bad.CpnyID AS nvarchar(max)))=N'' OR DATALENGTH(RTRIM(CAST(bad.CpnyID AS nvarchar(max))))>20) OR (bad.OrdNbr IS NULL OR RTRIM(CAST(bad.OrdNbr AS nvarchar(max)))=N'' OR DATALENGTH(RTRIM(CAST(bad.OrdNbr AS nvarchar(max))))>30)) AND NOT EXISTS (SELECT 1 FROM dbo.SOHeader bad GROUP BY CAST(RTRIM(CAST(bad.CpnyID AS nvarchar(max))) AS nvarchar(10)) COLLATE Latin1_General_100_BIN2,DATALENGTH(RTRIM(CAST(bad.CpnyID AS nvarchar(max)))),CAST(RTRIM(CAST(bad.OrdNbr AS nvarchar(max))) AS nvarchar(15)) COLLATE Latin1_General_100_BIN2,DATALENGTH(RTRIM(CAST(bad.OrdNbr AS nvarchar(max)))) HAVING COUNT(1)<>1)",
"tableName": ""
},
{
"cacheMode": "live",
"calculatedFields": [],
"customQueryIntegrationName": "",
"endpointPath": "",
"fetchSortRules": [
{
"direction": "ascending",
"id": "0DFAD758-78C9-5201-B33A-DB0385E9511A",
"key": "LineNbr",
"type": "number"
},
{
"direction": "ascending",
"id": "38F61D5E-BAB6-5BA0-9081-0A7F02099C14",
"key": "LineKey",
"type": "text"
}
],
"id": "42A7CBEC-F5BA-5AE7-93CB-3268F7227B54",
"mappings": [
{
"commonFieldKey": "",
"key": "LineKey",
"label": "Internal complete order context",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "LineKey",
"type": "text",
"visibleInDetail": false,
"visibleInList": false
},
{
"commonFieldKey": "",
"key": "OrderKey",
"label": "Internal complete order context",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "OrderKey",
"type": "text",
"visibleInDetail": false,
"visibleInList": false
},
{
"commonFieldKey": "",
"key": "OrderContext",
"label": "Internal complete order context",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "OrderContext",
"type": "text",
"visibleInDetail": false,
"visibleInList": false
},
{
"commonFieldKey": "",
"key": "CpnyID",
"label": "Stored company code",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "CpnyID",
"type": "text",
"visibleInDetail": true,
"visibleInList": false
},
{
"commonFieldKey": "",
"key": "OrdNbr",
"label": "Order number",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "OrdNbr",
"type": "text",
"visibleInDetail": true,
"visibleInList": false
},
{
"commonFieldKey": "",
"key": "LineRef",
"label": "Order line reference",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "LineRef",
"type": "text",
"visibleInDetail": true,
"visibleInList": false
},
{
"commonFieldKey": "",
"key": "LineNbr",
"label": "Stored line number",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "LineNbr",
"type": "number",
"visibleInDetail": true,
"visibleInList": false
},
{
"commonFieldKey": "",
"key": "InvtID",
"label": "Product business code",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "InvtID",
"type": "text",
"visibleInDetail": true,
"visibleInList": true
},
{
"commonFieldKey": "",
"key": "Descr",
"label": "Stored line description",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "Descr",
"type": "text",
"visibleInDetail": true,
"visibleInList": false
},
{
"commonFieldKey": "",
"key": "QtyOrd",
"label": "Stored quantity ordered",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "QtyOrd",
"type": "number",
"visibleInDetail": true,
"visibleInList": true
},
{
"commonFieldKey": "",
"key": "QtyShip",
"label": "Stored quantity shipped",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "QtyShip",
"type": "number",
"visibleInDetail": true,
"visibleInList": true
},
{
"commonFieldKey": "",
"key": "QtyBO",
"label": "Stored backorder quantity",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "QtyBO",
"type": "number",
"visibleInDetail": true,
"visibleInList": true
},
{
"commonFieldKey": "",
"key": "UnitDesc",
"label": "Stored quantity unit",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "UnitDesc",
"type": "text",
"visibleInDetail": true,
"visibleInList": true
},
{
"commonFieldKey": "",
"key": "CurySlsPrice",
"label": "Stored sales price — document currency",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "CurySlsPrice",
"type": "number",
"visibleInDetail": true,
"visibleInList": true
},
{
"commonFieldKey": "",
"key": "CuryTotOrd",
"label": "Stored line amount — document currency",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "CuryTotOrd",
"type": "number",
"visibleInDetail": true,
"visibleInList": false
},
{
"commonFieldKey": "",
"key": "SiteID",
"label": "Stored line site code",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "SiteID",
"type": "text",
"visibleInDetail": true,
"visibleInList": true
},
{
"commonFieldKey": "",
"key": "PromDate",
"label": "Stored promised date",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "PromDate",
"type": "date",
"visibleInDetail": true,
"visibleInList": false
},
{
"commonFieldKey": "",
"key": "ReqDate",
"label": "Stored requested date",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "ReqDate",
"type": "date",
"visibleInDetail": true,
"visibleInList": false
},
{
"commonFieldKey": "",
"key": "Status",
"label": "Stored line status code",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "Status",
"type": "text",
"visibleInDetail": true,
"visibleInList": false
},
{
"commonFieldKey": "",
"key": "ProjectID",
"label": "Stored line project code",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "ProjectID",
"type": "text",
"visibleInDetail": true,
"visibleInList": false
},
{
"commonFieldKey": "",
"key": "TaskID",
"label": "Stored line task code",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "TaskID",
"type": "text",
"visibleInDetail": true,
"visibleInList": false
},
{
"commonFieldKey": "",
"key": "DocumentCurrency",
"label": "Parent document currency code",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "DocumentCurrency",
"type": "text",
"visibleInDetail": true,
"visibleInList": true
},
{
"commonFieldKey": "",
"key": "DocumentCustomer",
"label": "Parent customer business code",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "DocumentCustomer",
"type": "text",
"visibleInDetail": true,
"visibleInList": false
},
{
"commonFieldKey": "",
"key": "LineScope",
"label": "Line value scope",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text",
"sourceColumn": "LineScope",
"type": "text",
"visibleInDetail": true,
"visibleInList": false
}
],
"maxRows": 1000,
"name": "Sales order lines",
"primaryKey": "LineKey",
"queryParameters": [
{
"constantValue": "",
"dayOffset": 0,
"fieldKey": "CpnyID",
"id": "BF30B2C5-35FE-57DE-869F-B7A855E54C3C",
"name": "company",
"source": "parentField",
"type": "text"
},
{
"constantValue": "",
"dayOffset": 0,
"fieldKey": "OrdNbr",
"id": "04F58FA0-E551-5717-ABDE-4ADEFF263188",
"name": "order",
"source": "parentField",
"type": "text"
},
{
"constantValue": "",
"dayOffset": 0,
"fieldKey": "OrderContext",
"id": "6BA9756E-C1F9-57F2-93E8-0815E73EE05E",
"name": "orderContext",
"source": "parentField",
"type": "text"
}
],
"refreshPolicy": {
"enabled": false,
"intervalMinutes": 60
},
"rootArrayPath": "",
"rowLimitEnabled": true,
"searchKeys": [
"CpnyID",
"OrdNbr",
"LineRef",
"LineNbr",
"InvtID",
"Descr",
"QtyOrd",
"QtyShip",
"QtyBO",
"UnitDesc",
"CurySlsPrice",
"CuryTotOrd",
"SiteID",
"PromDate",
"ReqDate",
"Status",
"ProjectID",
"TaskID",
"DocumentCurrency",
"DocumentCustomer",
"LineScope"
],
"sourceID": "7158F496-3450-55CC-81C8-3094B1D702A6",
"sqlQuery": "SELECT RTRIM(CAST(a.CpnyID AS nvarchar(max))) AS CpnyID,RTRIM(CAST(a.OrdNbr AS nvarchar(max))) AS OrdNbr,RTRIM(CAST(a.LineRef AS nvarchar(max))) AS LineRef,a.LineNbr AS LineNbr,a.InvtID AS InvtID,a.Descr AS Descr,a.QtyOrd AS QtyOrd,a.QtyShip AS QtyShip,a.QtyBO AS QtyBO,a.UnitDesc AS UnitDesc,a.CurySlsPrice AS CurySlsPrice,a.CuryTotOrd AS CuryTotOrd,a.SiteID AS SiteID,a.PromDate AS PromDate,a.ReqDate AS ReqDate,a.Status AS Status,a.ProjectID AS ProjectID,a.TaskID AS TaskID,CONCAT(CASE WHEN RTRIM(CAST(a.CpnyID AS nvarchar(max))) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(RTRIM(CAST(a.CpnyID AS nvarchar(max))) AS nvarchar(max))),N':',CAST(RTRIM(CAST(a.CpnyID AS nvarchar(max))) AS nvarchar(max)),N';') END,CASE WHEN RTRIM(CAST(a.OrdNbr AS nvarchar(max))) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(RTRIM(CAST(a.OrdNbr AS nvarchar(max))) AS nvarchar(max))),N':',CAST(RTRIM(CAST(a.OrdNbr AS nvarchar(max))) AS nvarchar(max)),N';') END,CASE WHEN RTRIM(CAST(a.LineRef AS nvarchar(max))) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(RTRIM(CAST(a.LineRef AS nvarchar(max))) AS nvarchar(max))),N':',CAST(RTRIM(CAST(a.LineRef AS nvarchar(max))) AS nvarchar(max)),N';') END) AS LineKey,CONCAT(CASE WHEN RTRIM(CAST(a.CpnyID AS nvarchar(max))) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(RTRIM(CAST(a.CpnyID AS nvarchar(max))) AS nvarchar(max))),N':',CAST(RTRIM(CAST(a.CpnyID AS nvarchar(max))) AS nvarchar(max)),N';') END,CASE WHEN RTRIM(CAST(a.OrdNbr AS nvarchar(max))) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(RTRIM(CAST(a.OrdNbr AS nvarchar(max))) AS nvarchar(max))),N':',CAST(RTRIM(CAST(a.OrdNbr AS nvarchar(max))) AS nvarchar(max)),N';') END) AS OrderKey,:orderContext AS OrderContext,m.CuryID AS DocumentCurrency,m.CustID AS DocumentCustomer,N'Separate stored quantities and source Cury values; no converted or calculated outstanding total' AS LineScope FROM dbo.SOLine a INNER JOIN dbo.SOHeader m ON (RTRIM(CAST(m.CpnyID AS nvarchar(max))) COLLATE Latin1_General_100_BIN2=RTRIM(CAST(a.CpnyID AS nvarchar(max))) COLLATE Latin1_General_100_BIN2 AND DATALENGTH(RTRIM(CAST(m.CpnyID AS nvarchar(max))))=DATALENGTH(RTRIM(CAST(a.CpnyID AS nvarchar(max))))) AND (RTRIM(CAST(m.OrdNbr AS nvarchar(max))) COLLATE Latin1_General_100_BIN2=RTRIM(CAST(a.OrdNbr AS nvarchar(max))) COLLATE Latin1_General_100_BIN2 AND DATALENGTH(RTRIM(CAST(m.OrdNbr AS nvarchar(max))))=DATALENGTH(RTRIM(CAST(a.OrdNbr AS nvarchar(max))))) WHERE (RTRIM(CAST(a.CpnyID AS nvarchar(max))) COLLATE Latin1_General_100_BIN2=RTRIM(CAST(:company AS nvarchar(max))) COLLATE Latin1_General_100_BIN2 AND DATALENGTH(RTRIM(CAST(a.CpnyID AS nvarchar(max))))=DATALENGTH(RTRIM(CAST(:company AS nvarchar(max))))) AND (RTRIM(CAST(a.OrdNbr AS nvarchar(max))) COLLATE Latin1_General_100_BIN2=RTRIM(CAST(:order AS nvarchar(max))) COLLATE Latin1_General_100_BIN2 AND DATALENGTH(RTRIM(CAST(a.OrdNbr AS nvarchar(max))))=DATALENGTH(RTRIM(CAST(:order AS nvarchar(max))))) AND NOT EXISTS (SELECT 1 FROM dbo.SOHeader bad WHERE (bad.CpnyID IS NULL OR RTRIM(CAST(bad.CpnyID AS nvarchar(max)))=N'' OR DATALENGTH(RTRIM(CAST(bad.CpnyID AS nvarchar(max))))>20) OR (bad.OrdNbr IS NULL OR RTRIM(CAST(bad.OrdNbr AS nvarchar(max)))=N'' OR DATALENGTH(RTRIM(CAST(bad.OrdNbr AS nvarchar(max))))>30)) AND NOT EXISTS (SELECT 1 FROM dbo.SOHeader bad GROUP BY CAST(RTRIM(CAST(bad.CpnyID AS nvarchar(max))) AS nvarchar(10)) COLLATE Latin1_General_100_BIN2,DATALENGTH(RTRIM(CAST(bad.CpnyID AS nvarchar(max)))),CAST(RTRIM(CAST(bad.OrdNbr AS nvarchar(max))) AS nvarchar(15)) COLLATE Latin1_General_100_BIN2,DATALENGTH(RTRIM(CAST(bad.OrdNbr AS nvarchar(max)))) HAVING COUNT(1)<>1) AND NOT EXISTS (SELECT 1 FROM dbo.SOLine bad WHERE (RTRIM(CAST(bad.CpnyID AS nvarchar(max))) COLLATE Latin1_General_100_BIN2=RTRIM(CAST(:company AS nvarchar(max))) COLLATE Latin1_General_100_BIN2 AND DATALENGTH(RTRIM(CAST(bad.CpnyID AS nvarchar(max))))=DATALENGTH(RTRIM(CAST(:company AS nvarchar(max))))) AND (RTRIM(CAST(bad.OrdNbr AS nvarchar(max))) COLLATE Latin1_General_100_BIN2=RTRIM(CAST(:order AS nvarchar(max))) COLLATE Latin1_General_100_BIN2 AND DATALENGTH(RTRIM(CAST(bad.OrdNbr AS nvarchar(max))))=DATALENGTH(RTRIM(CAST(:order AS nvarchar(max))))) AND ((bad.CpnyID IS NULL OR RTRIM(CAST(bad.CpnyID AS nvarchar(max)))=N'' OR DATALENGTH(RTRIM(CAST(bad.CpnyID AS nvarchar(max))))>20) OR (bad.OrdNbr IS NULL OR RTRIM(CAST(bad.OrdNbr AS nvarchar(max)))=N'' OR DATALENGTH(RTRIM(CAST(bad.OrdNbr AS nvarchar(max))))>30) OR (bad.LineRef IS NULL OR RTRIM(CAST(bad.LineRef AS nvarchar(max)))=N'' OR DATALENGTH(RTRIM(CAST(bad.LineRef AS nvarchar(max))))>10))) AND NOT EXISTS (SELECT 1 FROM dbo.SOLine bad WHERE (RTRIM(CAST(bad.CpnyID AS nvarchar(max))) COLLATE Latin1_General_100_BIN2=RTRIM(CAST(:company AS nvarchar(max))) COLLATE Latin1_General_100_BIN2 AND DATALENGTH(RTRIM(CAST(bad.CpnyID AS nvarchar(max))))=DATALENGTH(RTRIM(CAST(:company AS nvarchar(max))))) AND (RTRIM(CAST(bad.OrdNbr AS nvarchar(max))) COLLATE Latin1_General_100_BIN2=RTRIM(CAST(:order AS nvarchar(max))) COLLATE Latin1_General_100_BIN2 AND DATALENGTH(RTRIM(CAST(bad.OrdNbr AS nvarchar(max))))=DATALENGTH(RTRIM(CAST(:order AS nvarchar(max))))) GROUP BY CAST(RTRIM(CAST(bad.LineRef AS nvarchar(max))) AS nvarchar(5)) COLLATE Latin1_General_100_BIN2,DATALENGTH(RTRIM(CAST(bad.LineRef AS nvarchar(max)))) HAVING COUNT(1)<>1) AND (CONCAT(CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.CpnyID),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CpnyID),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CpnyID),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.OrdNbr),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.OrdNbr),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.OrdNbr),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.OrdDate),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.OrdDate),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.OrdDate),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.CustID),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CustID),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CustID),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.CustOrdNbr),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CustOrdNbr),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CustOrdNbr),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.SOTypeID),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.SOTypeID),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.SOTypeID),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.Status),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.Status),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.Status),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.BuyerName),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BuyerName),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BuyerName),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryID),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryID),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryID),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotOrd),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotOrd),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotOrd),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotMerch),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotMerch),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotMerch),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotTax),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotTax),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotTax),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotFrt),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotFrt),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotFrt),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.BillName),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillName),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillName),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.BillAttn),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillAttn),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillAttn),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.BillPhone),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillPhone),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillPhone),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.BillAddr1),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillAddr1),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillAddr1),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.BillAddr2),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillAddr2),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillAddr2),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.BillCity),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillCity),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillCity),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.BillState),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillState),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillState),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.BillZip),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillZip),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillZip),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.BillCountry),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillCountry),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillCountry),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipName),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipName),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipName),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipAttn),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipAttn),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipAttn),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipPhone),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipPhone),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipPhone),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipAddr1),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipAddr1),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipAddr1),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipAddr2),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipAddr2),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipAddr2),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipCity),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipCity),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipCity),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipState),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipState),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipState),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipZip),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipZip),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipZip),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipCountry),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipCountry),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipCountry),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShiptoID),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShiptoID),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShiptoID),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipViaID),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipViaID),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipViaID),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipSiteID),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipSiteID),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipSiteID),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.TermsID),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.TermsID),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.TermsID),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.SlsperID),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.SlsperID),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.SlsperID),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ProjectID),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ProjectID),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ProjectID),2) AS nvarchar(max)),N';') END) COLLATE Latin1_General_100_BIN2=:orderContext COLLATE Latin1_General_100_BIN2 AND DATALENGTH(CONCAT(CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.CpnyID),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CpnyID),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CpnyID),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.OrdNbr),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.OrdNbr),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.OrdNbr),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.OrdDate),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.OrdDate),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.OrdDate),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.CustID),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CustID),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CustID),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.CustOrdNbr),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CustOrdNbr),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CustOrdNbr),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.SOTypeID),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.SOTypeID),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.SOTypeID),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.Status),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.Status),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.Status),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.BuyerName),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BuyerName),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BuyerName),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryID),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryID),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryID),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotOrd),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotOrd),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotOrd),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotMerch),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotMerch),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotMerch),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotTax),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotTax),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotTax),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotFrt),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotFrt),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.CuryTotFrt),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.BillName),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillName),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillName),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.BillAttn),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillAttn),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillAttn),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.BillPhone),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillPhone),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillPhone),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.BillAddr1),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillAddr1),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillAddr1),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.BillAddr2),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillAddr2),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillAddr2),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.BillCity),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillCity),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillCity),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.BillState),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillState),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillState),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.BillZip),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillZip),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillZip),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.BillCountry),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillCountry),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.BillCountry),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipName),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipName),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipName),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipAttn),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipAttn),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipAttn),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipPhone),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipPhone),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipPhone),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipAddr1),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipAddr1),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipAddr1),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipAddr2),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipAddr2),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipAddr2),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipCity),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipCity),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipCity),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipState),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipState),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipState),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipZip),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipZip),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipZip),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipCountry),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipCountry),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipCountry),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShiptoID),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShiptoID),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShiptoID),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipViaID),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipViaID),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipViaID),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipSiteID),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipSiteID),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ShipSiteID),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.TermsID),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.TermsID),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.TermsID),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.SlsperID),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.SlsperID),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.SlsperID),2) AS nvarchar(max)),N';') END,CASE WHEN CONVERT(varchar(max),CONVERT(varbinary(max),m.ProjectID),2) IS NULL THEN CAST(N'~;' AS nvarchar(max)) ELSE CONCAT(N'=',DATALENGTH(CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ProjectID),2) AS nvarchar(max))),N':',CAST(CONVERT(varchar(max),CONVERT(varbinary(max),m.ProjectID),2) AS nvarchar(max)),N';') END))=DATALENGTH(:orderContext))",
"tableName": ""
}
],
"pages": [
{
"actions": [
{
"id": "847994EE-7C42-5D0B-8877-3E02541F62E2",
"kind": "showRelated",
"relatedInitiallyExpanded": false,
"relatedPresentation": "separate",
"relatedPreviewLimit": 12,
"relatedRowStyle": "cards",
"relatedShowsCount": true,
"relationID": "E1F86427-7F71-5069-B9DA-50F7A0733DE8",
"systemImage": "list.bullet.rectangle",
"targetDatasetID": "42A7CBEC-F5BA-5AE7-93CB-3268F7227B54",
"title": "Order lines",
"urlKey": ""
}
],
"badgeKey": "",
"cardEnrichments": [],
"cardFieldLayout": [
{
"detailGroup": "",
"detailRole": "information",
"isVisible": true,
"key": "CustID",
"label": "Customer code",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "",
"detailRole": "information",
"isVisible": true,
"key": "BuyerName",
"label": "Buyer",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "",
"detailRole": "information",
"isVisible": true,
"key": "OrdDate",
"label": "Order date",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "",
"detailRole": "information",
"isVisible": true,
"key": "CpnyID",
"label": "Company",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "",
"detailRole": "information",
"isVisible": true,
"key": "CuryID",
"label": "Currency code",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "",
"detailRole": "information",
"isVisible": true,
"key": "CuryTotOrd",
"label": "Stored order amount",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "",
"detailRole": "information",
"isVisible": true,
"key": "Status",
"label": "Status code",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "",
"detailRole": "information",
"isVisible": true,
"key": "LineAvailability",
"label": "Order lines",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
}
],
"datasetID": "52A34698-0276-5ABD-BA27-240717E0F426",
"dateFilterKey": "",
"dateFilterLastDays": 7,
"dateFilterPreset": "none",
"detailFieldLayout": [
{
"detailGroup": "Order identity and buyer",
"detailRole": "information",
"isVisible": true,
"key": "OrdNbr",
"label": "Order number",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "Order identity and buyer",
"detailRole": "information",
"isVisible": true,
"key": "OrdDate",
"label": "Stored order date",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "Order identity and buyer",
"detailRole": "information",
"isVisible": true,
"key": "CpnyID",
"label": "Stored company code",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "Order identity and buyer",
"detailRole": "information",
"isVisible": true,
"key": "CustID",
"label": "Customer business code",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "Order identity and buyer",
"detailRole": "information",
"isVisible": true,
"key": "CustOrdNbr",
"label": "Customer order reference",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "Order identity and buyer",
"detailRole": "information",
"isVisible": true,
"key": "BuyerName",
"label": "Buyer name",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "Order identity and buyer",
"detailRole": "information",
"isVisible": true,
"key": "SOTypeID",
"label": "Stored order type code",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "Order identity and buyer",
"detailRole": "information",
"isVisible": true,
"key": "Status",
"label": "Stored order status code",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "Stored document amounts",
"detailRole": "information",
"isVisible": true,
"key": "CuryID",
"label": "Stored document currency code",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "Stored document amounts",
"detailRole": "information",
"isVisible": true,
"key": "CuryTotOrd",
"label": "Stored order amount — document currency",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "Stored document amounts",
"detailRole": "information",
"isVisible": true,
"key": "CuryTotMerch",
"label": "Stored merchandise amount — document currency",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "Stored document amounts",
"detailRole": "information",
"isVisible": true,
"key": "CuryTotTax",
"label": "Stored tax amount — document currency",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "Stored document amounts",
"detailRole": "information",
"isVisible": true,
"key": "CuryTotFrt",
"label": "Stored freight amount — document currency",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "Billing identity and contact on this order",
"detailRole": "information",
"isVisible": true,
"key": "BillName",
"label": "Order billing name",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "Billing identity and contact on this order",
"detailRole": "information",
"isVisible": true,
"key": "BillAttn",
"label": "Order billing contact",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "Billing identity and contact on this order",
"detailRole": "information",
"isVisible": true,
"key": "BillPhone",
"label": "Order billing phone",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "Billing address on this order",
"detailRole": "information",
"isVisible": true,
"key": "BillAddr1",
"label": "Order billing address line 1",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "Billing address on this order",
"detailRole": "information",
"isVisible": true,
"key": "BillAddr2",
"label": "Order billing address line 2",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "Billing address on this order",
"detailRole": "information",
"isVisible": true,
"key": "BillCity",
"label": "Order billing city",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "Billing address on this order",
"detailRole": "information",
"isVisible": true,
"key": "BillState",
"label": "Order billing state / region",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "Billing address on this order",
"detailRole": "information",
"isVisible": true,
"key": "BillZip",
"label": "Order billing postal code",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "Billing address on this order",
"detailRole": "information",
"isVisible": true,
"key": "BillCountry",
"label": "Order billing country code",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "Shipping identity and contact on this order",
"detailRole": "information",
"isVisible": true,
"key": "ShipName",
"label": "Order shipping name",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "Shipping identity and contact on this order",
"detailRole": "information",
"isVisible": true,
"key": "ShipAttn",
"label": "Order shipping contact",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "Shipping identity and contact on this order",
"detailRole": "information",
"isVisible": true,
"key": "ShipPhone",
"label": "Order shipping phone",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "Shipping address on this order",
"detailRole": "information",
"isVisible": true,
"key": "ShipAddr1",
"label": "Order shipping address line 1",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "Shipping address on this order",
"detailRole": "information",
"isVisible": true,
"key": "ShipAddr2",
"label": "Order shipping address line 2",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "Shipping address on this order",
"detailRole": "information",
"isVisible": true,
"key": "ShipCity",
"label": "Order shipping city",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "Shipping address on this order",
"detailRole": "information",
"isVisible": true,
"key": "ShipState",
"label": "Order shipping state / region",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "Shipping address on this order",
"detailRole": "information",
"isVisible": true,
"key": "ShipZip",
"label": "Order shipping postal code",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "Shipping address on this order",
"detailRole": "information",
"isVisible": true,
"key": "ShipCountry",
"label": "Order shipping country code",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "Commercial and shipping codes",
"detailRole": "information",
"isVisible": true,
"key": "ShiptoID",
"label": "Stored ship-to business code",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "Commercial and shipping codes",
"detailRole": "information",
"isVisible": true,
"key": "ShipViaID",
"label": "Stored shipping method code",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "Commercial and shipping codes",
"detailRole": "information",
"isVisible": true,
"key": "ShipSiteID",
"label": "Stored shipping site code",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "Commercial and shipping codes",
"detailRole": "information",
"isVisible": true,
"key": "TermsID",
"label": "Stored payment terms code",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "Commercial and shipping codes",
"detailRole": "information",
"isVisible": true,
"key": "SlsperID",
"label": "Stored salesperson code",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "Commercial and shipping codes",
"detailRole": "information",
"isVisible": true,
"key": "ProjectID",
"label": "Stored project code",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "Order-line reading and scope",
"detailRole": "information",
"isVisible": true,
"key": "LineAvailability",
"label": "Order-line identity availability",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "Order-line reading and scope",
"detailRole": "information",
"isVisible": true,
"key": "OrderScope",
"label": "Order record scope",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
}
],
"detailLiveRefreshSeconds": 0,
"fixedFilters": [],
"id": "9B9ADC4D-E3A3-55BC-B184-39E11892820D",
"openFilters": [
{
"datePeriodOptions": [
"today",
"currentMonth",
"last7Days",
"last30Days",
"last90Days"
],
"id": "0B128AE1-A9B8-5A28-B02A-A081500D6351",
"includeAllOption": false,
"key": "OrdDate",
"title": "Order-date period",
"type": "date"
},
{
"id": "6C289EEA-BF42-5BE7-A691-557C9389CF27",
"includeAllOption": false,
"key": "CpnyID",
"title": "Company",
"type": "text"
}
],
"pageSize": 100,
"requiresOpeningFilterSelection": true,
"showOnHome": true,
"sortRules": [
{
"direction": "descending",
"id": "1818BCCF-34E2-5074-B231-2555B6895775",
"key": "OrdDate",
"type": "date"
},
{
"direction": "ascending",
"id": "995FEE5B-187A-5A70-BA4C-6AAAE9E26915",
"key": "OrdNbr",
"type": "text"
},
{
"direction": "ascending",
"id": "E6DC6CBA-8DAF-5077-A998-3D2DE4004901",
"key": "OrderKey",
"type": "text"
}
],
"subtitle": "",
"subtitleKey": "CustOrdNbr",
"systemImage": "cart",
"title": "Sales orders",
"titleKey": "OrdNbr"
},
{
"actions": [],
"badgeKey": "",
"cardEnrichments": [],
"cardFieldLayout": [
{
"detailGroup": "",
"detailRole": "information",
"isVisible": true,
"key": "InvtID",
"label": "Product code",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "",
"detailRole": "information",
"isVisible": true,
"key": "QtyOrd",
"label": "Ordered qty",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "",
"detailRole": "information",
"isVisible": true,
"key": "UnitDesc",
"label": "Unit",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "",
"detailRole": "information",
"isVisible": true,
"key": "QtyShip",
"label": "Shipped qty",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "",
"detailRole": "information",
"isVisible": true,
"key": "QtyBO",
"label": "Backorder qty",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "",
"detailRole": "information",
"isVisible": true,
"key": "CurySlsPrice",
"label": "Stored sales price",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "",
"detailRole": "information",
"isVisible": true,
"key": "DocumentCurrency",
"label": "Currency code",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "",
"detailRole": "information",
"isVisible": true,
"key": "SiteID",
"label": "Site code",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
}
],
"datasetID": "42A7CBEC-F5BA-5AE7-93CB-3268F7227B54",
"dateFilterKey": "",
"dateFilterLastDays": 7,
"dateFilterPreset": "none",
"detailFieldLayout": [
{
"detailGroup": "Line business identity",
"detailRole": "information",
"isVisible": true,
"key": "Descr",
"label": "Stored line description",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "Line business identity",
"detailRole": "information",
"isVisible": true,
"key": "InvtID",
"label": "Product business code",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "Line business identity",
"detailRole": "information",
"isVisible": true,
"key": "CpnyID",
"label": "Stored company code",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "Line business identity",
"detailRole": "information",
"isVisible": true,
"key": "OrdNbr",
"label": "Order number",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "Line business identity",
"detailRole": "information",
"isVisible": true,
"key": "LineRef",
"label": "Order line reference",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "Line business identity",
"detailRole": "information",
"isVisible": true,
"key": "LineNbr",
"label": "Stored line number",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "Line business identity",
"detailRole": "information",
"isVisible": true,
"key": "DocumentCustomer",
"label": "Parent customer business code",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "Separate stored quantities",
"detailRole": "information",
"isVisible": true,
"key": "QtyOrd",
"label": "Stored quantity ordered",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "Separate stored quantities",
"detailRole": "information",
"isVisible": true,
"key": "QtyShip",
"label": "Stored quantity shipped",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "Separate stored quantities",
"detailRole": "information",
"isVisible": true,
"key": "QtyBO",
"label": "Stored backorder quantity",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "Separate stored quantities",
"detailRole": "information",
"isVisible": true,
"key": "UnitDesc",
"label": "Stored quantity unit",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "Stored prices and document currency",
"detailRole": "information",
"isVisible": true,
"key": "CurySlsPrice",
"label": "Stored sales price — document currency",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "Stored prices and document currency",
"detailRole": "information",
"isVisible": true,
"key": "CuryTotOrd",
"label": "Stored line amount — document currency",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "Stored prices and document currency",
"detailRole": "information",
"isVisible": true,
"key": "DocumentCurrency",
"label": "Parent document currency code",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "Schedule and operational codes",
"detailRole": "information",
"isVisible": true,
"key": "ReqDate",
"label": "Stored requested date",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "Schedule and operational codes",
"detailRole": "information",
"isVisible": true,
"key": "PromDate",
"label": "Stored promised date",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "Schedule and operational codes",
"detailRole": "information",
"isVisible": true,
"key": "Status",
"label": "Stored line status code",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "Schedule and operational codes",
"detailRole": "information",
"isVisible": true,
"key": "SiteID",
"label": "Stored line site code",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "Schedule and operational codes",
"detailRole": "information",
"isVisible": true,
"key": "ProjectID",
"label": "Stored line project code",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "Schedule and operational codes",
"detailRole": "information",
"isVisible": true,
"key": "TaskID",
"label": "Stored line task code",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
},
{
"detailGroup": "Scope",
"detailRole": "information",
"isVisible": true,
"key": "LineScope",
"label": "Line value scope",
"locationLabelKey": "",
"locationLongitudeKey": "",
"presentation": "text"
}
],
"detailLiveRefreshSeconds": 0,
"fixedFilters": [],
"id": "42B50FA4-37FC-5246-BD77-3AA13319F49D",
"openFilters": [],
"pageSize": 100,
"requiresOpeningFilterSelection": false,
"showOnHome": false,
"sortRules": [
{
"direction": "ascending",
"id": "0DFAD758-78C9-5201-B33A-DB0385E9511A",
"key": "LineNbr",
"type": "number"
},
{
"direction": "ascending",
"id": "38F61D5E-BAB6-5BA0-9081-0A7F02099C14",
"key": "LineKey",
"type": "text"
}
],
"subtitle": "",
"subtitleKey": "LineRef",
"systemImage": "list.bullet",
"title": "Order lines",
"titleKey": "Descr"
}
],
"relations": [
{
"childDatasetID": "42A7CBEC-F5BA-5AE7-93CB-3268F7227B54",
"childKey": "OrderKey",
"id": "E1F86427-7F71-5069-B9DA-50F7A0733DE8",
"name": "Order lines",
"parentDatasetID": "52A34698-0276-5ABD-BA27-240717E0F426",
"parentKey": "OrderKey"
}
],
"widgets": []
}
},
"format": "cifru-configuration-package",
"formatVersion": 1,
"manifest": {
"applicationName": "Microsoft Dynamics SL",
"configurationLanguages": [
"en"
],
"countries": [
"US"
],
"createdAt": "2026-10-10T00:00:00Z",
"description": "UNOFFICIAL — NOT VALIDATED ON A REAL ERP INSTALLATION.\n\nFor sales, customer service, warehouse coordinators and managers: choose an order-date period and company, find an order, inspect its customer reference, buyer, stored amounts and separate billing/shipping contacts and addresses. Open Order lines only when needed to see products, quantities, native units, stored prices, requested/promised dates, sites and project/task codes.\n\nWhy Cifru? Adapt configurations to the way you work. Choose the fields, filters and details you need, and bring information to your phone that may not be available in your business software’s own mobile app. Available options depend on the data exposed by your authorized source and your Cifru plan.\n\nPro: one SQL source, one Home button, two lists and one on-demand related button. 39 order values and 21 line values are organised in complete Details; internal keys and row tokens are hidden. Search and native opening filters are included. Each live read is bounded to 1,000 rows, without automatic refresh or preloading all lines. Identity checks can scan beyond the visible cap; a capped list is not a complete company total or a performance guarantee.\n\nMicrosoft explicitly registers SOHeader/SOLine source objects and documents company/order binding in pinned migration code. The AL logical keys are company+order and company+order+line reference. Invalid, oversized, blank or duplicated header identities reject the root read; ambiguous line identities block only their own order. Every selected parent field is checked again before reading lines; refresh the order after a source change. No RefNbr-only link, first-row fallback or silent duplicate removal.\n\nBilling and shipping values come from this order itself, not today's Customer/SOAddress master. Type/status/company/site/terms codes remain source values. Stored Cury-prefixed amounts are shown with the parent document currency code: no ISO guarantee, conversion, signed-total formula, receivables balance, payment status or sales aggregation. Ordered, shipped and backorder quantities are separate stored fields with UnitDesc; no guessed subtraction. The opening period uses order date, not posting or requested/promised date.\n\nDocumentary and synthetic validation only: no real Dynamics SL or SQL Server installation, physical DDL, SQL types, indexes, query plan, installed owner/release or ERP roles has been verified. Map the authorised SL business database and complete the import read/compatibility test. dbo is only the proposed owner, not the system database or a Business Central migration destination. Direct SQL does not inherit ERP sessions/company ACL. Company filters and hidden keys are not access control. Use a separate administrator-scoped SELECT-only reporting login; never copy migration sysadmin/db_owner instructions.\n\nNo bank/card, source credentials, host, username/password, audit or custom/future fields are included. Screenshots use entirely fictional DEMO rows, not a live SL connection. Ordinary order contacts and commercial amounts can still be confidential. Unofficial, not Microsoft endorsed. SL is a distinct legacy installed-base product, with extended support ending July 2028; no current top-three or no-native-mobile claim.\n\nSource registration: https://github.com/microsoft/ALAppExtensions/blob/e7ed235bc979c0283306e9639ff7cd22ce78341d/Apps/W1/HybridSL/app/src/codeunits/SLHybridWizard.Codeunit.al\nHeader fields: https://github.com/microsoft/ALAppExtensions/blob/e7ed235bc979c0283306e9639ff7cd22ce78341d/Apps/W1/HybridSL/app/src/Migration/SalesOrders/SLSOHeaderBuffer.Table.al\nLine fields: https://github.com/microsoft/ALAppExtensions/blob/e7ed235bc979c0283306e9639ff7cd22ce78341d/Apps/W1/HybridSL/app/src/Migration/SalesOrders/SLSOLineBuffer.Table.al\nCompany/order binding: https://github.com/microsoft/ALAppExtensions/blob/e7ed235bc979c0283306e9639ff7cd22ce78341d/Apps/W1/HybridSL/app/src/Migration/History/SLPopulateHistTables.Codeunit.al",
"licenseCode": "Cifru-Community-1.0",
"minimumCifruVersion": "1.1.0",
"minimumPlan": "pro",
"packageID": "2DAD7FB0-A15C-534F-A880-083DE03124A9",
"rootButtonCount": 1,
"summary": "Order-date/company selection, buyer, separate order billing/shipping records, native amounts and on-demand product lines.",
"tags": [
"Dynamics SL",
"SQL Server",
"Sales orders",
"Order lines",
"Billing",
"Shipping",
"Pro"
],
"title": "Sales orders and complete line dossier — Pro"
}
}