{"id":28037,"date":"2017-06-16T15:06:13","date_gmt":"2017-06-16T07:06:13","guid":{"rendered":"http:\/\/localhost\/help\/?page_id=28037"},"modified":"2024-08-15T10:31:31","modified_gmt":"2024-08-15T02:31:31","slug":"singlevalueswitch","status":"publish","type":"page","link":"https:\/\/oihelp.corporate.ifs.com\/help\/p2-server\/calculations\/singlevalueswitch\/","title":{"rendered":"SingleValueSwitch()"},"content":{"rendered":"\n<h2>Format<\/h2>\n<p class=\"intro-text\"><strong>SingleValueSwitch(InputValues ,Case1Value ,Case1Result ,Case2Value ,Case2Result [,OtherCases])<\/strong><\/p>\n<h2>Returns<\/h2>\n<p class=\"intro-text\">Returns the replacement value for the input value based on which case was matched for the input value.<\/p>\n<h2>Inputs<\/h2>\n<p class=\"intro-text\"><b>InputValues: <\/b>The input value that the function will compare to available cases and replace.<br \/>\nBehaviour: Required<br \/>\nDimensions: Collection, SingleValue<br \/>\nValid data types: Null, Boolean, DateTime, Decimal, Integer, String, Duration<\/p>\n<p class=\"intro-text\"><b>Case1Value: <\/b>The value of the first case.<br \/>\nBehaviour: Required<br \/>\nDimensions: SingleValue<br \/>\nValid data types: Null, Boolean, DateTime, Decimal, Integer, String, Duration<\/p>\n<p class=\"intro-text\"><b>Case1Result: <\/b>The expression which will be (lazily) evaluated and used to replace the input value if it matched the value of this case.<br \/>\nBehaviour: Required<br \/>\nDimensions: SingleValue<br \/>\n<em>Note: Also supports a single string that contains an expression which returns a multi-collection variable, but a multi-collection of string is not supported.<\/em><br \/>\nValid data types: String<\/p>\n<p class=\"intro-text\"><b>Case2Value: <\/b>The value of the second case.<br \/>\nBehaviour: Required<br \/>\nDimensions: SingleValue<br \/>\nValid data types: Null, Boolean, DateTime, Decimal, Integer, String, Duration<\/p>\n<p class=\"intro-text\"><b>Case2Result: <\/b>The expression which will be (lazily) evaluated and used to replace the input value if it matched the value of this case.<br \/>\nBehaviour: Required<br \/>\nDimensions: SingleValue<br \/>\n<em>Note: Also supports a single string that contains an expression which returns a multi-collection variable, but a multi-collection of string is not supported.<\/em><br \/>\nValid data types: String<\/p>\n<p class=\"intro-text\"><b>OtherCases: <\/b>Subsequent cases must follow the existing pattern. I.e. even numbered parameters must contain possible values, odd numbered subsequent parameters must contain the expression which will be (lazily) evaluated and used to replace the input value.<br \/>\nBehaviour: ParamsArray<br \/>\nDimensions: SingleValue<br \/>\nValid data types: Null, Boolean, DateTime, Decimal, Integer, String, Duration<\/p>\n<p class=\"left-bar\"><a href=\"https:\/\/oihelp.corporate.ifs.com\/help\/p2-server\/calculations\/calculation-syntax\/#Data_Type\">How to format data types<\/a><\/p>\n<h2>Examples<\/h2>\n<p class=\"intro-text\">Expression: Switch(1 + 1, 1, \"'case 1'\", 2, \"'case 2'\", 3, \"'case 3'\")<br \/>\nResult: Returns the string \"case 2\".<\/p>\n<p class=\"intro-text\">Expression: Switch({Tag1}, 1, \"{Tag2}\", 2, \"{Tag3}\", 3, \"{Tag4}\")<br \/>\nResult: Returns all fetched values of {Tag2}, {Tag3} or {Tag4} depending on whether the fetched value of {Tag1} was 1, 2 or 3.<\/p>\n<h2><span id=\"Release_History\">Release History<\/span><\/h2>\n<ul class=\"intro-text\">\n<li>SingleValueSwitch() 4.6.5\n<ul class=\"intro-text\">\n<li>Changed Case1Result and Case2Result parameters to support an expression containing a MultiCollection value.<\/li>\n<\/ul>\n<\/li>\n<li>SingleValueSwitch() 4.5.1\n<ul class=\"intro-text\">\n<li>Initial version<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Returns the replacement value for the input value based on which case was matched for the input value.<\/p>\n<p class=\"continue-reading-button\"> <a class=\"continue-reading-link\" href=\"https:\/\/oihelp.corporate.ifs.com\/help\/p2-server\/calculations\/singlevalueswitch\/\">Read more<i class=\"crycon-right-dir\"><\/i><\/a><\/p>\n","protected":false},"author":1,"featured_media":28086,"parent":3650,"menu_order":191,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":"","_members_access_role":[],"_members_access_error":""},"categories":[9],"tags":[100],"class_list":["post-28037","page","type-page","status-publish","has-post-thumbnail","hentry","category-tech-ref","tag-calculations","Version-4-5-1","Version-4-6-5","Product-srv"],"_links":{"self":[{"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/pages\/28037","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/comments?post=28037"}],"version-history":[{"count":3,"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/pages\/28037\/revisions"}],"predecessor-version":[{"id":64779,"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/pages\/28037\/revisions\/64779"}],"up":[{"embeddable":true,"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/pages\/3650"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/media\/28086"}],"wp:attachment":[{"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/media?parent=28037"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/categories?post=28037"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/tags?post=28037"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}