User bio
404 bio not found
Member since Oct 12, 2020
Posts:
Ian has not published any posts yet.
Replies:

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 } }

Certifications & Credly badges:
Ian has no Certifications & Credly badges yet.
Global Masters badges:
Followers:
Ian has no followers yet.
Following:
Ian has not followed anybody yet.