i want to change this function so that the dates a...
# ask-stanley-ai
n
i want to change this function so that the dates are between 1/1/2024 and 31/12/2024 CASE WHEN {type} IN ('Invoice', 'Cash Sale') AND {trandate} BETWEEN ADD_MONTHS(SYSDATE, -12) AND SYSDATE THEN {quantity} WHEN {type} IN ('Credit Memo', 'Cash Refund') AND {trandate} BETWEEN ADD_MONTHS(SYSDATE, -12) AND SYSDATE THEN +{quantity} ELSE NULL END
c
AI generated answer (using internal Slack threads):
Based on the provided Slack threads, it seems like you want to modify your function to filter dates between 1/1/2024 and 31/12/2024. You can achieve this by replacing the
ADD_MONTHS(SYSDATE, -12) AND SYSDATE
part of your function with the specific dates you want. Here's how you can modify your function:
Copy code
sql
CASE
    WHEN {type} IN ('Invoice', 'Cash Sale') AND {trandate} BETWEEN TO_DATE('01/01/2024', 'MM/DD/YYYY') AND TO_DATE('12/31/2024', 'MM/DD/YYYY') THEN {quantity}
    WHEN {type} IN ('Credit Memo', 'Cash Refund') AND {trandate} BETWEEN TO_DATE('01/01/2024', 'MM/DD/YYYY') AND TO_DATE('12/31/2024', 'MM/DD/YYYY') THEN +{quantity}
    ELSE NULL
END
This function will now consider only the transactions that happened between 1/1/2024 and 31/12/2024 for 'Invoice', 'Cash Sale', 'Credit Memo', and 'Cash Refund' types. ****** 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.85393846
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.84232831
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.839186847
Please provide your feedback on this answer.