2020年12月21日星期一

SuiteScript 'N/Query' SuiteQL cannot includes keywords 'DISTINCT'? [closed]

Its good to run the runSuitePage(), but when I fetch the data, there is one error called 'Invalid search' catched, when 'DISTINCT' word moved, its all ok. I dont know what to do. So I Just give up using keywords 'DISTIenter code hereNCT'.

But I really wanna use 'DISTINCT' to filter repeat data.

var bannedItemIdArr = [];      var querySQL = "SELECT DISTINCT item.ID AS idRAW /*{id#RAW}*/ FROM item, (SELECT itemMember.parentitem AS parentitem, itemMember.parentitem AS parentitem_join, itemMember.ID AS ID, item_0.itemtype AS itemtype, itemMember.item AS item, item_0.itemtype AS itemtype_crit, item_0.isinactive AS isinactive_crit FROM itemMember, item item_0 WHERE itemMember.item = item_0.ID(+)) itemMember_SUB WHERE item.ID = itemMember_SUB.parentitem(+) AND ((UPPER(item.itemtype) IN ('ASSEMBLY') AND UPPER(itemMember_SUB.itemtype_crit) IN ('INVTPART', 'ASSEMBLY') AND itemMember_SUB.isinactive_crit = 'T' AND NVL(item.isinactive, 'F') = 'F'))";      //+了DISTINCT 就不能fetch data什么鬼?, 然后单引号不能换, 双引号可移除?      var myPagedResults = query.runSuiteQLPaged({ query: querySQL, pageSize: 1000, });  

console.log(myPagedResults.count); const myPage = myPagedResults.fetch({index: 0});

If you know something about it, please note me, thank you!

https://stackoverflow.com/questions/65383142/suitescript-n-query-suiteql-cannot-includes-keywords-distinct December 21, 2020 at 02:08AM

没有评论:

发表评论