{"id":507,"date":"2008-01-04T19:03:01","date_gmt":"2008-01-05T02:03:01","guid":{"rendered":"http:\/\/members.crystalreportsbook.com\/crystal-reports-xi\/813-switch\/"},"modified":"2008-10-24T11:32:00","modified_gmt":"2008-10-24T18:32:00","slug":"813-switch","status":"publish","type":"post","link":"http:\/\/www.crystalreportsonlinetraining.com\/training\/813-switch\/","title":{"rendered":"8.11 Switch"},"content":{"rendered":"<h2>The Switch() Function<\/h2>\n<p>The Switch() function is also like a shortcut for the If statement and the Select Case statement. The parameters are grouped in pairs. The first parameter is an expression to test and the second parameter is a result value that is returned if the expression is true.<\/p>\n<p>The syntax for the Switch() function is as follows:<\/p>\n<p><code_single><\/code_single>Var = Switch(condition1, result1, condition2, result2, &#8230;.)<\/p>\n<p>What makes this unique from the If and Select Case statements is that every parameter is evaluated before a result is returned from the function. This can have good or bad results depending upon your needs. The result can be bad because there could be a performance issue if you are passing time-intensive functions as parameters or it could result in an error being raised. It can be good if you want to force various functions to be called prior to returning a value.. This function can return any data type except for an array. The data types of each result must be the same.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Switch() Function The Switch() function is also like a shortcut for the If statement and the Select Case statement. The parameters are grouped in pairs. The first parameter is an expression to test and the second parameter is a result value that is returned if the expression is true. The syntax for the Switch() [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[28,2],"tags":[],"class_list":["post-507","post","type-post","status-publish","format-standard","hentry","category-chapter-8-programming-with-basic-syntax","category-crystal-reportsnet-2003","entry"],"_links":{"self":[{"href":"http:\/\/www.crystalreportsonlinetraining.com\/training\/wp-json\/wp\/v2\/posts\/507","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.crystalreportsonlinetraining.com\/training\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.crystalreportsonlinetraining.com\/training\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.crystalreportsonlinetraining.com\/training\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.crystalreportsonlinetraining.com\/training\/wp-json\/wp\/v2\/comments?post=507"}],"version-history":[{"count":0,"href":"http:\/\/www.crystalreportsonlinetraining.com\/training\/wp-json\/wp\/v2\/posts\/507\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.crystalreportsonlinetraining.com\/training\/wp-json\/wp\/v2\/media?parent=507"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.crystalreportsonlinetraining.com\/training\/wp-json\/wp\/v2\/categories?post=507"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.crystalreportsonlinetraining.com\/training\/wp-json\/wp\/v2\/tags?post=507"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}