I have a need to calculate a status value based on (a) Open and Closed date combinations and (b) an override value, if present.
My formula validates, my trigger validates, and all works well for creating status based on the data fields, but I get an error when basing it on the override field.
StatusOverride is a Text(255) data type.
Status is a formula in Admissions and a Text(255) in Admissions_AuditLog. Formula:
CASE
WHEN IsNull([@field:StatusOverride], 0) != 0
THEN [@field:StatusOverride]
WHEN IsNull([@field:DateOpened], 0) = 0 AND IsNull([@field:DateClosed], 0) = 0
THEN 'Pending'
WHEN IsNull([@field:DateOpened], 0) != 0 AND IsNull([@field:DateClosed], 0) = 0
THEN 'Open'
WHEN IsNull([@field:DateOpened], 0) != 0 AND IsNull([@field:DateClosed], 0) != 0
THEN 'Closed'
ELSE 'Error'
END
GOOD: If I add an admission record with no date, I successfully get a status of Pending as expected, and record is successfully written to audit log.
GOOD: If I add an admission record with an opening date but not closing date, I successfully get a status of Open as expected, and record is successfully written to audit log.
GOOD: If I add an admission record with an opening date and a closing date, I successfully get a status of Closed as expected, and record is successfully written to audit log.
GOOD: If I add an admission record with a closing date but not opening date, I successfully get a status of Error as expected, and record is successfully written to audit log.
ERROR: If I add an admission record with a status override value, I get ERROR: Record cannot be saved because an error was encountered in Triggered Actions.
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
Question
Becca37
I have a need to calculate a status value based on (a) Open and Closed date combinations and (b) an override value, if present.
My formula validates, my trigger validates, and all works well for creating status based on the data fields, but I get an error when basing it on the override field.
StatusOverride is a Text(255) data type.
Status is a formula in Admissions and a Text(255) in Admissions_AuditLog. Formula:
CASE
WHEN IsNull([@field:StatusOverride], 0) != 0
THEN [@field:StatusOverride]
WHEN IsNull([@field:DateOpened], 0) = 0 AND IsNull([@field:DateClosed], 0) = 0
THEN 'Pending'
WHEN IsNull([@field:DateOpened], 0) != 0 AND IsNull([@field:DateClosed], 0) = 0
THEN 'Open'
WHEN IsNull([@field:DateOpened], 0) != 0 AND IsNull([@field:DateClosed], 0) != 0
THEN 'Closed'
ELSE 'Error'
END
GOOD: If I add an admission record with no date, I successfully get a status of Pending as expected, and record is successfully written to audit log.
GOOD: If I add an admission record with an opening date but not closing date, I successfully get a status of Open as expected, and record is successfully written to audit log.
GOOD: If I add an admission record with an opening date and a closing date, I successfully get a status of Closed as expected, and record is successfully written to audit log.
GOOD: If I add an admission record with a closing date but not opening date, I successfully get a status of Error as expected, and record is successfully written to audit log.
ERROR: If I add an admission record with a status override value, I get ERROR: Record cannot be saved because an error was encountered in Triggered Actions.
Can anyone tell me what I'm doing wrong? :0)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TEST RECORDS:
DATA TABLES DESIGN:
TRIGGER:
Link to comment
Share on other sites
5 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.