Modify below statement to return '-' only for the ...
# ask-stanley-ai
v
Modify below statement to return '-' only for the row with maximum {custrecord_muts_tss_employee.employee<timebill.id} and when TO_CHAR({custrecord_muts_tss_date},'YYYY-MM') = TO_CHAR({custrecord_muts_tss_employee.employee<timebill.trandate}, 'YYYY-MM') COALESCE( CASE WHEN TO_CHAR({custrecord_muts_tss_date}, 'YYYY-MM-DD') = TO_CHAR({custrecord_muts_tss_employee.employee<timebill.trandate}, 'YYYY-MM-DD') THEN TO_char({custrecord_muts_tss_date}, 'YYYY/MM/DD') END, CASE WHEN TO_CHAR({custrecord_muts_tss_date},'YYYY-MM') = TO_CHAR({custrecord_muts_tss_employee.employee<timebill.trandate}, 'YYYY-MM') THEN '-' END, NULL )
c
AI generated answer (using internal Slack threads):
Based on the provided Slack threads/conversations, the modification to the statement would be as follows:
Copy code
sql
COALESCE(
    CASE WHEN TO_CHAR({custrecord_muts_tss_date}, 'YYYY-MM-DD') =
             TO_CHAR({custrecord_muts_tss_employee.employee<timebill.trandate}, 'YYYY-MM-DD')
        THEN TO_char({custrecord_muts_tss_date}, 'YYYY/MM/DD')
    END,
    CASE WHEN TO_CHAR({custrecord_muts_tss_date},'YYYY-MM') =
             TO_CHAR({custrecord_muts_tss_employee.employee<timebill.trandate}, 'YYYY-MM')
             AND {custrecord_muts_tss_employee.employee<timebill.id} = 
                 (SELECT MAX({custrecord_muts_tss_employee.employee<timebill.id}) FROM {table})
        THEN '-'
    END,
    NULL
)
This modification adds a condition to the second
CASE
statement to only return '-' for the row with the maximum
{custrecord_muts_tss_employee.employee<timebill.id}
. ****** 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.808197916
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.799572945
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.798885643
Please provide your feedback on this answer.