pixiEmillControlCustomers
Returns customers whose number of orders with order lines in status ANG or recent AUS reaches a minimum count, optionally filtered by shop.
Lists customers who have several qualifying orders, for example to spot duplicate or suspicious orders by the same customer.
Steps:
- An empty
ShopIDis treated asNULL, which means no shop filter. - An order qualifies if at least one of its lines in
Orderlinesmeets either condition:- status
ANG, regardless of date, or - status
AUSandOrderDateless thanDayRangedays ago, measured as calendar-day difference to today.
- status
- Qualifying orders in
OrderHeaderare joined toCustomersviaCustRef=CustKey. - If
ShopIDis set, only customers whoseCustomerOfequalsShopIDare included. - Results are grouped per customer (
CustRef). Only customers with at leastMinOrderCountqualifying orders are returned.
Each row contains the customer's name, e-mail address, number of qualifying orders and shop. The result has no explicit sort order.
Notes
- All tables are read with
NOLOCK. Results may include uncommitted data. - Because of SQL operator precedence (
ANDbeforeOR), theDayRangerestriction applies only to lines in statusAUS. Orders withANGlines are counted no matter how old they are. - The code does not show which table the unqualified
OrderDatecolumn belongs to. IfOrderlineshas no such column, the order date fromOrderHeaderis used. - The shop filter uses the customer's shop (
CustomerOf), not the shop of the order. Name,eMailandShopIDare built withMAX()per customer group.
Tables used
| Parameter | Type | Default | Description |
|---|---|---|---|
DayRange
|
int | 10 |
Number of days back from today in which the order date must lie. Applies only to order lines in status Example: |
MinOrderCount
|
int | 2 |
Minimum number of qualifying orders a customer must have to be returned. Example: |
ShopID
|
varchar(3) string |
NULL |
Shop of the customer ( Example: |
Result set 1 · Always (may be empty)
One row per customer with at least MinOrderCount qualifying orders.
| Column | Type | Description |
|---|---|---|
Name
Nullable |
string |
Customer name ( |
eMail
Nullable |
string |
Customer e-mail address ( |
AnzahlBestellungen
|
int |
Number of qualifying orders of the customer. |
ShopID
Nullable |
string |
Shop the customer belongs to ( |
Response example
<SqlRowSet1>
<row>
<Name>Max Mustermann</Name>
<eMail>max.mustermann@example.de</eMail>
<AnzahlBestellungen>3</AnzahlBestellungen>
<ShopID>SH1</ShopID>
</row>
<row>
<Name>Erika Musterfrau</Name>
<eMail>erika@example.com</eMail>
<AnzahlBestellungen>2</AnzahlBestellungen>
<ShopID>SH1</ShopID>
</row>
</SqlRowSet1>
POST https://apigateway.descartes.com/tms/pixi/
Content-Type: text/xml; charset=utf-8
Authorization: Basic BASE64(USERNAME:PASSWORD)
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="https://apigateway.descartes.com/tms/pixi/">
<SOAP-ENV:Body>
<ns1:pixiEmillControlCustomers>
<!-- <DayRange>10</DayRange> -->
<!-- <MinOrderCount>2</MinOrderCount> -->
<!-- <ShopID>SH1</ShopID> -->
</ns1:pixiEmillControlCustomers>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
curl -X POST 'https://apigateway.descartes.com/tms/pixi/' \
--user 'USERNAME:PASSWORD' \
--header 'Content-Type: text/xml; charset=utf-8' \
--data-binary @- <<'XML'
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="https://apigateway.descartes.com/tms/pixi/">
<SOAP-ENV:Body>
<ns1:pixiEmillControlCustomers>
<!-- <DayRange>10</DayRange> -->
<!-- <MinOrderCount>2</MinOrderCount> -->
<!-- <ShopID>SH1</ShopID> -->
</ns1:pixiEmillControlCustomers>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
XML
<?php
$soapClient = new SoapClient(null, [
'login' => 'USERNAME',
'password' => 'PASSWORD',
'location' => 'https://apigateway.descartes.com/tms/pixi/',
'uri' => 'https://apigateway.descartes.com/tms/pixi/',
]);
$arguments = [
// 'DayRange' => '10',
// 'MinOrderCount' => '2',
// 'ShopID' => 'SH1',
];
$soapArguments = [];
foreach ($arguments as $name => $value) {
$soapArguments[] = new SoapVar($value, XSD_STRING, '', '', $name);
}
$response = $soapClient->__soapCall('pixiEmillControlCustomers', $soapArguments);
- SQL object:
- dbo.pipiEmillControlCustomers