<@UFAHSLYJ1> The record browser would tell you why...
# suitescript
a
@Craig The record browser would tell you why. There are fields that while accessible via the N/record methods are not exposed to searches as columns to be returned, this is one of them…(it may be available via the query module tho).
💯 1
☝️ 1
a
you should be able to get search values for amount and discount amount and you can calculate the rate yourself? not sure if n/query would work here. or you can solve via loading the record which also works. https://www.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2024_1/script/record/transaction.html
c
Looking at the record browser I see: discountamount currency Amount Discount
under: Search Columns
a
right that's the amount .. not the rate
👍 1
c
I also noted I couldn't find it in SuiteAnalytics either.
a
(discount amount / amount )* 100/1 >> rate
c
I've never understood what can and cannot be accessed via n/search. Could it be because it's some sort of calculated field?
a
that's my assumption, its effectively not a "store value" field
and its just calculated at runtime
it does seem to be somewhat arbitrary though
c
record,load must source/calculate it but a search does not 🤷
a
yeah I've given up trying to guess with this stuff, it happens, I confirm i'm not crazy with the record browser, then bite the bullet and either do a record.load if there's no performance concern, or get "creative" if it there is performance concerns 😄
b
generally you need to have an understanding of how searches and records (and ultimately queries) represent their data
a search represents a transaction as multiple lines, with one of the lines representing the discount for the transaction with a relevant rate and amount
the transaction also has a mainline, which provides summaries of the entire transaction
it makes no sense for there to be a summary discount rate when there can be multiple discounts on the transaction, hence why you wont find one
search.lookupFields only can get you columns on that mainline, if you want information from a different line, you need to write out a full search
c
But there is a summary discount rate; that's what the discountrate mainline field is?
b
make a transaction search in the ui with the {discountrate} in the formula, run it and observe
c
Yes, same result
Not available via sql either.
It must be some sort of calculated field.
b
its essential to learn that records, queries, and searches represent their data differently
on records, the discount rate is an actual field you can enter a value for, its certainly not calculated
on searches the discount rate is represented differently, specifically as a different line than the mainline
with its own rate, amount, and probably useless quantity
that said, searches and queries are more similar to each other than records