i have a suiteql query in which i need to pass the...
# suiteql
v
i have a suiteql query in which i need to pass the date as the parameter. I had done this like below but it shows error var results = query.runSuiteQL({ query: 'SELECT '+ 'item.itemid, item.id, item.displayname, bomcomp.item, itemcomp.itemid,'+ 'itemcomp.displayname, bomcomp.bomquantity, itemcomp.itemtype, '+ 'itemcomp.custitem_cmb_rollup_cost, itemcomp.lastpurchaseprice '+ 'FROM assemblyitembom assbom, item, bom, bomrevision bomrev, '+ 'bomrevisioncomponent bomcomp,item itemcomp '+ 'WHERE '+ 'assbom.assembly = item.id '+ 'AND bomcomp.item = itemcomp.id '+ 'AND assbom.billofmaterials = bom.id '+ 'AND bomrev.billofmaterials = bom.id '+ 'AND bomcomp.bomrevision = bomrev.id '+ 'AND (bomrev.effectivestartdate is NULL OR bomrev.effectivestartdate <= ?)', params: [stringDate] }); could anyone please help me?
j
What is the error you are getting? Also, you should use template literals so you can do multiline strings.
b
It's hard to help without knowing the error or the value you're passing for the parameter. If the query runs fine without the parameter then that's the likely culprit. Dates can be finicky so that wouldn't be surprising.
a
Try using passing in the parameter manually i.e
bomrev.effectivestartdate < TO_DATE('01/01/2022', 'MM/DD/YYYY
)` I write a little regarding querying bom components here: https://netsuitediagnostics.com/tags/bills-of-materials/