How do I use the builtin.df function in SuiteQL?
# ask-stanley-ai
r
How do I use the builtin.df function in SuiteQL?
c
AI generated answer (using internal Slack threads):
The
BUILTIN.DF
function in SuiteQL is used to return the display value of a field from the target record type without having to join the target record type explicitly. It can be thought of as meaning Display Field or Display Format. Here is an example of how to use it:
Copy code
javascript
var sql = 'select BUILTIN.DF(receivablesaccount) from customer where id = 3231'
var results = query.runSuiteQL({query: sql, params: []}).asMappedResults()
In this example, replace
3231
with the ID of the customer you want to query. This will return the string name of the
receivablesaccount
field for that customer, not the account ID. You can also use
BUILTIN.DF
in conjunction with a
GROUP BY
clause. Here is an example:
Copy code
javascript
select 
    BUILTIN.DF(currency),
    count(*)
from account
where accttype = 'Bank'
group by BUILTIN.DF(currency)
This query will group the results by the display value of the
currency
field. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.819545448
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.817581117
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.794842541
Please provide your feedback on this answer.