NetSuite query SQL

Netsuite query SQL

1
2
3
4
5
6
7
8
9
10
11
12
13
SELECT
--top 10
custbody_pri_prj projectid,
max(trandate),
max(trandisplayname),
max(memo),
max(type),
--trandisplayname,
--*
from transaction
where custbody_pri_prj is not null
and trandate >= to_date(add_months(CURRENT_DATE, -6))
group by custbody_pri_prj

Statement used in Saved Search:

1
2
3
4
5
6
7
8
9
CASE WHEN {quantity}-{custcol_pri_fgt_cntr_direct_imp_total} > 0 THEN
CASE WHEN {custcol_pri_fgt_cntr_direct_imp_poloc} IS NOT NULL THEN
'<a class="dottedlink" href="/app/accounting/transactions/purchord.nl?whence=&custbody_pri_fgt_cntr_direct_imp_so='|| REGEXP_REPLACE(, '_\d+', '') || '&entity='|| {custcol_pri_fgt_cntr_po_vendor.id} ||'&location='|| {custcol_pri_fgt_cntr_direct_imp_poloc.id} ||'&custbody_pri_frgt_loc_ult='|| {location.id}|| '">Generate PO</a>'
ELSE
'Not Applicable'
END
ELSE
'Fully Generated'
END