{"id":26653,"date":"2023-05-31T04:16:35","date_gmt":"2023-05-31T04:16:35","guid":{"rendered":"https:\/\/www.greytrix.com\/blogs\/sagex3\/?p=26653"},"modified":"2024-11-26T10:27:02","modified_gmt":"2024-11-26T10:27:02","slug":"previous-function-in-crystal-reports","status":"publish","type":"post","link":"https:\/\/www.greytrix.com\/blogs\/sagex3\/2023\/05\/31\/previous-function-in-crystal-reports\/","title":{"rendered":"PREVIOUS() function in Crystal Reports"},"content":{"rendered":"\n<p>In the <a href=\"https:\/\/www.greytrix.com\/sage-x3-erp\/\" target=\"_blank\" data-type=\"URL\" data-id=\"https:\/\/www.greytrix.com\/product\/erp-development\/sage-x3\" rel=\"noreferrer noopener\">Sage X3<\/a>, we have various standard reports for almost every screen which are developed in Crystal Report. Also we can develop new customized crystal report as per the client\u2019s need.<\/p>\n\n\n\n<p>For one of our client we have developed a report that contains all the information related to Work Orders (report is printing in excel format) and there was a requirement from the client that if the <strong>Operation Status<\/strong> is closed for the previous line then the <strong>Planned Qty<\/strong> of the previous line should be printed in a \u201c<strong>Previous Operation Qty<\/strong>\u201d field of current line.<\/p>\n\n\n\n<p>For this requirement, we have used the <strong>Previous()<\/strong> function in Crystal Report formula.<\/p>\n\n\n\n<p>To achieve the above requirement follow the below steps:<\/p>\n\n\n\n<p><strong>Step 1:<\/strong> Create a formula &#8216;<strong>fm_close<\/strong>&#8216; for previous line&#8217;s status (whether it is close or not)<\/p>\n\n\n\n<p><strong>New Stuff:<\/strong> <a href=\"https:\/\/www.greytrix.com\/blogs\/sagex3\/2023\/05\/30\/how-to-conditionally-format-fields-using-the-highlighting-expert-in-crystal-report\/\" target=\"_blank\" data-type=\"URL\" data-id=\"https:\/\/www.greytrix.com\/blogs\/sagex3\/2023\/05\/30\/how-to-conditionally-format-fields-using-the-highlighting-expert-in-crystal-report\/\" rel=\"noreferrer noopener\">How to conditionally format fields using the Highlighting Expert in Crystal Report<\/a><\/p>\n\n\n\n<center><a href=\"https:\/\/www.greytrix.com\/blogs\/sagex3\/wp-content\/uploads\/2023\/05\/Formula-fm_close.jpg\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" class=\"size-full\" style=\"border: 1px solid #A9A9A9; padding: 2px; margin: 2px; align: center;\" src=\"https:\/\/www.greytrix.com\/blogs\/sagex3\/wp-content\/uploads\/2023\/05\/Formula-fm_close.jpg\" alt=\"Formula fm_close\"><\/a><\/center>\n<font size=\"2\"><center>Formula fm_close<\/center><\/font>\n\n\n\n<p><strong>Step 2:<\/strong> Create another formula &#8216;<strong>Pre_Op_Qty<\/strong>&#8216; to retrieve the last line&#8217;s planned qty (if the status is closed for last line else print 0)<\/p>\n\n\n\n<center><a href=\"https:\/\/www.greytrix.com\/blogs\/sagex3\/wp-content\/uploads\/2023\/05\/Formula-Pre_Op_Qty.jpg\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" class=\"size-full\" style=\"border: 1px solid #A9A9A9; padding: 2px; margin: 2px; align: center;\" src=\"https:\/\/www.greytrix.com\/blogs\/sagex3\/wp-content\/uploads\/2023\/05\/Formula-Pre_Op_Qty.jpg\" alt=\"Formula Pre_Op_Qty\"><\/a><\/center>\n<font size=\"2\"><center>Formula Pre_Op_Qty<\/center><\/font>\n\n\n\n<p><strong>Step 3:<\/strong> Drag and drop this formula &#8216;Pre_Op_Qty&#8217; wherever you want to add in report.<\/p>\n\n\n\n<center><a href=\"https:\/\/www.greytrix.com\/blogs\/sagex3\/wp-content\/uploads\/2023\/05\/output-1.jpg\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" class=\"size-full\" style=\"border: 1px solid #A9A9A9; padding: 2px; margin: 2px; align: center;\" src=\"https:\/\/www.greytrix.com\/blogs\/sagex3\/wp-content\/uploads\/2023\/05\/output-1.jpg\" alt=\"Output\"><\/a><\/center>\n<font size=\"2\"><center>Output<\/center><\/font>\n\n\n\n<p>Refer the above screenshot in which you can check, by using previous function, we have printed planned quantity of previous line in the next line only if the operation status of previous line is \u201cClosed\u201d.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In the Sage X3, we have various standard reports for almost every screen which are developed in Crystal Report. Also we can develop new customized crystal report as per the client\u2019s need. For one of our client we have developed a report that contains all the information related to Work Orders (report is printing in\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.greytrix.com\/blogs\/sagex3\/2023\/05\/31\/previous-function-in-crystal-reports\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,13],"tags":[343,3747,461,3748,3749,2157],"class_list":["post-26653","post","type-post","status-publish","format-standard","hentry","category-sage-erp-x3","category-integration","tag-closed","tag-comments","tag-crystal-report","tag-previous-function","tag-previous-function-in-crystal-report","tag-status"],"_links":{"self":[{"href":"https:\/\/www.greytrix.com\/blogs\/sagex3\/wp-json\/wp\/v2\/posts\/26653","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.greytrix.com\/blogs\/sagex3\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.greytrix.com\/blogs\/sagex3\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/sagex3\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/sagex3\/wp-json\/wp\/v2\/comments?post=26653"}],"version-history":[{"count":11,"href":"https:\/\/www.greytrix.com\/blogs\/sagex3\/wp-json\/wp\/v2\/posts\/26653\/revisions"}],"predecessor-version":[{"id":30257,"href":"https:\/\/www.greytrix.com\/blogs\/sagex3\/wp-json\/wp\/v2\/posts\/26653\/revisions\/30257"}],"wp:attachment":[{"href":"https:\/\/www.greytrix.com\/blogs\/sagex3\/wp-json\/wp\/v2\/media?parent=26653"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/sagex3\/wp-json\/wp\/v2\/categories?post=26653"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/sagex3\/wp-json\/wp\/v2\/tags?post=26653"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}