我正在使用 PHP 连接到 Microsoft Dynamics Nav (Navision) Web Services 2016。身份验证 (NTLM) 工作正常,我可以获取数据。到目前为止,我正在测试项目页面和项目列表页面。
我可以轻松过滤我想要检索的项目,但现在我想过滤我检索的列。有没有办法做到这一点?基本上相当于一个MySQL SELECT this, that, theOther...
语句而不是SELECT *...
这是一些相关代码,我以本指南为起点。
try {
$pageURL = $baseURL . "ItemList";
$service = new NTLMSoapClient($pageURL);
// this filter says to get all items. I could change Criteria to an item number to get just that item.
$params = array('filter'=>array( array('Field'=>'No', 'Criteria'=>'*') ), 'setSize'=>20);
$result = $service->ReadMultiple($params);
$resultSet = $result->ReadMultiple_Result->ItemList;
if (is_array($resultSet)) {
foreach($resultSet as $rec) {
echo $rec->No . " " . $rec->Description."<br>";
}
} else {
echo $resultSet->No . " " . $resultSet->Description."<br>";
}
} catch (Exception $error) {
echo "<hr><b>ERROR: SoapException:</b> [" . $error . "]<hr>";
echo "<pre>" . htmlentities(print_r($service->__getLastRequest(),1)) . "</pre>";
}