SuiteQL 查询结果存在时返回空结果集。 [PreviousTransactionLineLine]

问题描述 投票:0回答:0

我正在使用这个查询,大部分时间都有效,但是在某些情况下它没有返回预期的结果:

"SELECT if.tranid as if_number, inv.tranid as inv_number, inv.trandate as invoice_date, inv.otherrefnum as po_number, so.tranid as so_number FROM transaction inv join transactionline line on inv.id = line.transaction join transaction so on so.id = line.createdfrom join transactionline so_line on so.id = so_line.transaction join previoustransactionlinelink ptll on ptll.previousdoc = so.id  and ptll.previousline = so_line.id join transaction if on if.id = ptll.nextdoc  WHERE inv.type = 'CustInvc' and line.mainline = 'T' and ptll.nexttype = 'ItemShip' and so.tranid in ('SO392950') and  inv.trandate = if.trandate"

我和

previoustransactionlinelink
previousdoc
一起加入
previousline
桌。但是,似乎在某些交易中
previousline
失败了。 当我在
previousdocwith where previousdoc = 1931587 and nexttype = 'ItemShip'
上运行时,我得到以下信息:

{
    "records": [
        {
            "foreignamount": null,
            "previoustype": "SalesOrd",
            "lastmodifieddate": "3/15/2023",
            "nextline": 0,
            "previousline": 1,
            "nexttype": "ItemShip",
            "previousdoc": 1931587,
            "nextdoc": 1959659,
            "linktype": "ShipRcpt"
        }
    ]
}

但是,当我添加

where previousdoc = 1931587 and nexttype = 'ItemShip' and previousline = 1
时,它会给出一个空的结果集。 我已将
ptll.previousline = so_line.id
包含在
where
on
子句中。
我也将两者都包装在
to_char
函数中。它仍然失败。

感谢您的帮助。

netsuite suitescript suiteql
© www.soinside.com 2019 - 2024. All rights reserved.