{"id":140,"date":"2007-12-30T21:31:36","date_gmt":"2007-12-31T04:31:36","guid":{"rendered":"http:\/\/members.crystalreportsbook.com\/crystal-reports-xi\/7-5-assigning-variables\/"},"modified":"2010-11-17T18:15:08","modified_gmt":"2010-11-18T01:15:08","slug":"7-5-assigning-variables","status":"publish","type":"post","link":"http:\/\/www.crystalreportsonlinetraining.com\/training\/7-5-assigning-variables\/","title":{"rendered":"7.05 Assigning Variables"},"content":{"rendered":"<h2>Variable Assignment<\/h2>\n<p>After creating a variable, you need to assign a value to it. This can be a simple constant, a data field, or the result of a more complex calculation. The key thing to remember is that the data types on both sides of the assignment must be the same. For example, you can&#8217;t assign a string to a DateTime variable. Crystal Reports gives you an error when it sees this. You either have to reconsider the validity of what you are attempting to do, or use a type conversion function to make the two compatible.<\/p>\n<p>Crystal syntax uses := to assign a value to a variable.<\/p>\n<p>         <code_Single>X := 5;<\/code_Single><br \/>\n         <code_Single>Y := &#8220;Mr. &#8221; &amp; {Customer.Last Name};<\/code_Single><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Variable Assignment After creating a variable, you need to assign a value to it. This can be a simple constant, a data field, or the result of a more complex calculation. The key thing to remember is that the data types on both sides of the assignment must be the same. For example, you can&#8217;t [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9,1],"tags":[],"class_list":["post-140","post","type-post","status-publish","format-standard","hentry","category-chapter-7-programming-with-crystal-syntax","category-crystal-reports-xi","entry"],"_links":{"self":[{"href":"http:\/\/www.crystalreportsonlinetraining.com\/training\/wp-json\/wp\/v2\/posts\/140","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=140"}],"version-history":[{"count":1,"href":"http:\/\/www.crystalreportsonlinetraining.com\/training\/wp-json\/wp\/v2\/posts\/140\/revisions"}],"predecessor-version":[{"id":1435,"href":"http:\/\/www.crystalreportsonlinetraining.com\/training\/wp-json\/wp\/v2\/posts\/140\/revisions\/1435"}],"wp:attachment":[{"href":"http:\/\/www.crystalreportsonlinetraining.com\/training\/wp-json\/wp\/v2\/media?parent=140"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.crystalreportsonlinetraining.com\/training\/wp-json\/wp\/v2\/categories?post=140"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.crystalreportsonlinetraining.com\/training\/wp-json\/wp\/v2\/tags?post=140"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}