case when {transactionlinetype} = 'Credit Memo' th...
# ask-stanley-ai
n
case when {transactionlinetype} = 'Credit Memo' then -{amount} else {amount} end update this formula to give unique items and remove the duplicates
c
AI generated answer (using internal Slack threads):
Based on the conversations, it seems like you want to update your formula to handle 'Credit Memo' transaction types differently and also remove duplicates. The formula you provided:
case when {transactionlinetype} = 'Credit Memo' then -{amount} else {amount} end
is used to flip the sign of the amount for 'Credit Memo' transaction types. To remove duplicates, you would typically use the
GROUP BY
clause in SQL. However, in NetSuite saved searches, there isn't a direct way to use
GROUP BY
. Instead, you can use the 'Main Line' filter set to 'No' to exclude summary lines, which can sometimes appear as duplicates. If you want to get unique items, you might need to adjust the fields you're displaying or the filters you're using. Without more information about your saved search, it's hard to provide a more specific solution. Here's an example of how you might modify your formula to handle 'Credit Memo' transaction types and attempt to remove duplicates:
Copy code
sql
CASE 
    WHEN {transactionlinetype} = 'Credit Memo' THEN -{amount} 
    ELSE {amount} 
END AS 'Adjusted Amount'
And then in your filters, you might have something like: - Main Line is false - Type is any of Invoice, Cash Sale, Credit Memo Remember to select 'Summary' type of saved search if you want to aggregate results. ****** 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.832285941
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.832044721
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.82710433
Please provide your feedback on this answer.