Hi Mary, this may work for you. It could do with a tidy up but should put you on the correct path. You can use this for testing - https://wiki.discoverydataservice.org/index.php?title=Dummy_NHS_numbers ClassMethod ValidNHS(pNHS As %String = "", Output pFailReason) As %Boolean { IF pNHS'?10N { set pFailReason = "Num" Quit 0 } set nCheckdigit = $Extract(pNHS,10,10) set nChi9Digits = $Extract(pNHS,1,9) set nMultFact = 2 set nCalcCheckdigit = 0 for i = 9 : -1 : 1 { set nThisDigit = $Extract(nChi9Digits,i,i) set nCalcCheckdigit = nCalcCheckdigit + (nThisDigit * nMultFact) set nMultFact = nMultFact + 1 } set nCalcCheckdigit = (nCalcCheckdigit # 11) set nCalcCheckdigit = 11 - nCalcCheckdigit if (nCalcCheckdigit = 10) { set pFailReason = "ChkDig" Quit 0 } if (nCalcCheckdigit = 11) { set nCalcCheckdigit = 0 } if (nCheckdigit = nCalcCheckdigit) { set pFailReason = "" Quit 1 } Else { set pFailReason = "ChkDig match" Quit 0 } }

rushed this out but may help. Remember utc you could extend the rules and then these would appear in the function dropdown. This would allow you to use objectscript to return the starttime and another method to return the enddatetime. You'd need to focus on yr default values in case any "in" values are invalid and for the second method - the 'duration' is this always in seconds? e.g Class GEN.Transform.cusFunctions Extends Ens.Rule.FunctionSet [ ProcedureBlock ] { ClassMethod retStartTime(in1 As %String = "", in2 As %String = "") As %String { s ret="" //default value? q:in1="" ret q:in2="" ret s ret=$zdt($zdth(in1_" "_in2,4),3,7) q ret } ClassMethod retEndTime(in1 As %String = "", in2 As %String = "", in3 As %String = "") As %String { s ret="" //default value? q:in1="" ret q:in2="" ret q:in3="" ret //need to determine if in3 is always in seconds - if yes then following may work s dt=$zdth(in1_" "_(in2),4) s $p(dt,",",2)=$p(dt,",",2)+in3 s ret=$zdt(dt,3,7) q ret } ------- test from terminal BPTLIVE>w in1 07/05/2022 BPTLIVE>w in2 14:30 BPTLIVE>w in3 30 BPTLIVE>w ##Class(GEN.Transform.cusFunctions).retStartTime(in1,in2) 2022-05-07T13:30:00Z BPTLIVE>w ##Class(GEN.Transform.cusFunctions).retEndTime(in1,in2,in3) 2022-05-07T13:30:30Z BPTLIVE>