Acumatica:检索显示字段视图中的第一条记录-无关的Order BY

Acumatica:检索显示字段视图中的第一条记录-无关的Order BY,acumatica,Acumatica,我们创建了一个屏幕和图形,用于存储有关库存项目(INItemLotSerial)的给定序列号的自定义信息 我希望能够显示序列号的当前位置,基于最近交易的位置。(理想情况下,我还希望能够显示序列号当前是否在库存中,但这可能是另一个问题。) 以下是我对图表的看法: public PXSelect<INTranSplit, Where<INTranSplit.lotSerialNbr, Equal<Optional<INItemLotSerial.lotSerialNbr>

我们创建了一个屏幕和图形,用于存储有关库存项目(INItemLotSerial)的给定序列号的自定义信息

我希望能够显示序列号的当前位置,基于最近交易的位置。(理想情况下,我还希望能够显示序列号当前是否在库存中,但这可能是另一个问题。)

以下是我对图表的看法:

public PXSelect<INTranSplit, Where<INTranSplit.lotSerialNbr, Equal<Optional<INItemLotSerial.lotSerialNbr>>, 
    And<INTranSplit.inventoryID, Equal<Optional<INItemLotSerial.inventoryID>>>>, OrderBy<Desc<INTranSplit.createdDateTime>>> InventoryLocation;
这会导致首先返回不同的记录,而不是最新的记录


我如何说服Acumatica运行我要求的BQL并按字段放弃额外订单?或者,是否有一种完全不同的方法来显示最新的事务位置更可取?

如果需要专门的筛选,我建议在这种情况下使用IEnumerable排序

public IEnumerable inventoryLocation()
{
        PXView select = new PXView(this, true, InventoryLocation.View.BqlSelect);
        Int32 totalrow = 0;
        Int32 startrow = PXView.StartRow;
        List<object> result = select.Select(PXView.Currents, PXView.Parameters, PXView.Searches,
            PXView.SortColumns, PXView.Descendings, PXView.Filters, ref startrow, PXView.MaximumRows, ref totalrow);
        INTranSplit latest = null;
        if (result.Count > 0)
        { 
            //We need to perform a custom order in order to get to the latest record.
            latest = result.First() as INTranSplit;
            foreach (INTranSplit row in result)
            {
                if (latest.CreatedDateTime.Value < row.CreatedDateTime.Value)
                {
                    latest = row;
                } 

            }
        }
        return new List<object> { latest };
}
public IEnumerable inventoryLocation()
{
PXView select=新PXView(这是true,InventoryLocation.View.BqlSelect);
Int32 totalrow=0;
Int32 startrow=PXView.startrow;
列表结果=select.select(PXView.Currents、PXView.Parameters、PXView.search、,
PXView.SortColumns、PXView.Downings、PXView.Filters、ref startrow、PXView.MaximumRows、ref totalrow);
内部拆分最新=空;
如果(result.Count>0)
{ 
//我们需要执行自定义订单以获取最新记录。
latest=result.First()作为内部拆分;
foreach(结果中的拆分行)
{
if(latest.CreatedDateTime.Value
在这里,您可以获取所有记录,获取第一条记录,然后查找最新记录


干杯

在这种特殊情况下,如果您需要专门的筛选,我建议您使用IEnumerable排序

public IEnumerable inventoryLocation()
{
        PXView select = new PXView(this, true, InventoryLocation.View.BqlSelect);
        Int32 totalrow = 0;
        Int32 startrow = PXView.StartRow;
        List<object> result = select.Select(PXView.Currents, PXView.Parameters, PXView.Searches,
            PXView.SortColumns, PXView.Descendings, PXView.Filters, ref startrow, PXView.MaximumRows, ref totalrow);
        INTranSplit latest = null;
        if (result.Count > 0)
        { 
            //We need to perform a custom order in order to get to the latest record.
            latest = result.First() as INTranSplit;
            foreach (INTranSplit row in result)
            {
                if (latest.CreatedDateTime.Value < row.CreatedDateTime.Value)
                {
                    latest = row;
                } 

            }
        }
        return new List<object> { latest };
}
public IEnumerable inventoryLocation()
{
PXView select=新PXView(这是true,InventoryLocation.View.BqlSelect);
Int32 totalrow=0;
Int32 startrow=PXView.startrow;
列表结果=select.select(PXView.Currents、PXView.Parameters、PXView.search、,
PXView.SortColumns、PXView.Downings、PXView.Filters、ref startrow、PXView.MaximumRows、ref totalrow);
内部拆分最新=空;
如果(result.Count>0)
{ 
//我们需要执行自定义订单以获取最新记录。
latest=result.First()作为内部拆分;
foreach(结果中的拆分行)
{
if(latest.CreatedDateTime.Value
在这里,您可以获取所有记录,获取第一条记录,然后查找最新记录


干杯

我可能弄错了,但我记得在使用选择器时,默认行为是先按键排序。在您的代码片段中,我们可以看到InTranSplit的键是按字段排序的。在INTranSplit.createdDateTime之后,您是否尝试过将键放入order by子句中?只是尝试了一下--没有效果。我可能弄错了,但我记得在使用选择器时,默认行为是先按键排序。在您的代码片段中,我们可以看到InTranSplit的键是按字段排序的。您是否尝试过在INTranSplit.createdDateTime之后将密钥放入order by子句中?只是尝试了一下--没有效果。
public IEnumerable inventoryLocation()
{
        PXView select = new PXView(this, true, InventoryLocation.View.BqlSelect);
        Int32 totalrow = 0;
        Int32 startrow = PXView.StartRow;
        List<object> result = select.Select(PXView.Currents, PXView.Parameters, PXView.Searches,
            PXView.SortColumns, PXView.Descendings, PXView.Filters, ref startrow, PXView.MaximumRows, ref totalrow);
        INTranSplit latest = null;
        if (result.Count > 0)
        { 
            //We need to perform a custom order in order to get to the latest record.
            latest = result.First() as INTranSplit;
            foreach (INTranSplit row in result)
            {
                if (latest.CreatedDateTime.Value < row.CreatedDateTime.Value)
                {
                    latest = row;
                } 

            }
        }
        return new List<object> { latest };
}