{"id":9948,"date":"2017-02-20T12:25:35","date_gmt":"2017-02-20T12:25:35","guid":{"rendered":"http:\/\/www.greytrix.com\/blogs\/sagex3\/?p=9948"},"modified":"2017-02-20T12:25:35","modified_gmt":"2017-02-20T12:25:35","slug":"optimize-the-performances-when-several-insertions-of-database-lines-must-be-done","status":"publish","type":"post","link":"https:\/\/www.greytrix.com\/blogs\/sagex3\/2017\/02\/20\/optimize-the-performances-when-several-insertions-of-database-lines-must-be-done\/","title":{"rendered":"Optimize the Performances when several Insertions of Database Lines must be done"},"content":{"rendered":"<p style=\"text-align: justify\">Sage X3 provides a special function <strong><em>Writeb<\/em><\/strong> to write into a table. It works similar to <strong><em>Write<\/em><\/strong> function but it allows us to optimize the performances when several insertions of database lines must be done.<\/p>\n<p><strong>Syntax:<\/strong><\/p>\n<p><strong>Writeb<\/strong><\/p>\n<p><strong>Writeb[<em>CLASS<\/em>]<\/strong><\/p>\n<p><strong>where, <\/strong><\/p>\n<p style=\"text-align: justify\"><span style=\"color: #0000ff\"><em>CLASS<\/em><\/span>: a classidentifier that corresponds to the abbreviation used to open a database table.<\/p>\n<p style=\"text-align: justify\"><span style=\"color: #0000ff\">Writeb<\/span> allows you to buffer the lines written in a database table before sending them globally. This instruction should be used when massive inserts are done in a given table.<\/p>\n<ul>\n<li>\n<p style=\"text-align: justify\">When [S]<a href=\"http:\/\/online-help.sageerpx3.com\/erp\/wp-static-content\/static-pages\/en_US\/v7dev\/4gl_adxwrb.html\" target=\"_blank\" rel=\"noopener\">adxwrb<\/a> &lt;= 1, Writeb works exactly as <a href=\"http:\/\/online-help.sageerpx3.com\/erp\/wp-static-content\/static-pages\/en_US\/v7dev\/4gl_write.html\" target=\"_blank\" rel=\"noopener\">Write<\/a>.<\/p>\n<\/li>\n<li>\n<p style=\"text-align: justify\">When [S]<a href=\"http:\/\/online-help.sageerpx3.com\/erp\/wp-static-content\/static-pages\/en_US\/v7dev\/4gl_adxwrb.html\" target=\"_blank\" rel=\"noopener\">adxwrb<\/a> &gt; 1, Writeb stores the lines to be written in a buffer, and flushes the buffer by transmitting the data to the database when reaching the buffer size, or when using the <a href=\"http:\/\/online-help.sageerpx3.com\/erp\/wp-static-content\/static-pages\/en_US\/v7dev\/4gl_flush.html\" target=\"_blank\" rel=\"noopener\">Flush<\/a><\/p>\n<\/li>\n<li>\n<p style=\"text-align: justify\">If a CLOB or a BLOB is present on the table, Writeb behaves exactly as <a href=\"http:\/\/online-help.sageerpx3.com\/erp\/wp-static-content\/static-pages\/en_US\/v7dev\/4gl_write.html\" target=\"_blank\" rel=\"noopener\">Write<\/a> (no buffering is done).<\/p>\n<\/li>\n<\/ul>\n<p style=\"text-align: justify\">Writeb updates <a href=\"http:\/\/online-help.sageerpx3.com\/erp\/wp-static-content\/static-pages\/en_US\/v7dev\/4gl_fstat.html\" target=\"_blank\" rel=\"noopener\"><strong>fstat<\/strong><\/a>to indicate the result of the write operation only when transmitting the data to the database. It is therefore not possible to identify the line in which the error occurred. The best practice is to run the transaction again with [S]<a href=\"http:\/\/online-help.sageerpx3.com\/erp\/wp-static-content\/static-pages\/en_US\/v7dev\/4gl_adxwrb.html\" target=\"_blank\" rel=\"noopener\"><strong>adxwrb<\/strong><\/a> set to 1. The <strong><a href=\"http:\/\/online-help.sageerpx3.com\/erp\/wp-static-content\/static-pages\/en_US\/v7dev\/4gl_fstat.html\" target=\"_blank\" rel=\"noopener\">fstat<\/a>\u00a0<\/strong>value will then be returned after every Writeb<strong>.<\/strong><\/p>\n<p>The values available for status are the following:<\/p>\n<table>\n<tbody>\n<tr>\n<td style=\"text-align: center;border: 1px solid #CCCCCC\">fstat value<\/td>\n<td style=\"text-align: center;border: 1px solid #CCCCCC\">Description<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;border: 1px solid #CCCCCC\">0<\/td>\n<td style=\"text-align: center;border: 1px solid #CCCCCC\">The write operation has been successful (or has only been placed for the moment in the write buffer).<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;border: 1px solid #CCCCCC\">1<\/td>\n<td style=\"text-align: center;border: 1px solid #CCCCCC\">Lock error on at least a database line.<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;border: 1px solid #CCCCCC\">3<\/td>\n<td style=\"text-align: center;border: 1px solid #CCCCCC\">An attempt to create a duplicate key has been detected.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>Hope this helps!<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p><strong>About Us:<\/strong><\/p>\n<p style=\"text-align: justify\">Greytrix is one stop solution provider for Sage ERP and Sage CRM needs. We provide complete end-to-end assistance for your technical consultations, product customizations, data migration, system integrations, third-party add-on development and implementation expertise.<\/p>\n<p style=\"text-align: justify\"><a href=\"http:\/\/www.greytrix.com\/\" target=\"_blank\">Greytrix<\/a> have some unique solutions of <a href=\"http:\/\/www.greytrix.com\/product\/sage-crm\/gumu-sage-x3-integration\" target=\"_blank\">Sage X3\u2019s integration with Sage CRM<\/a>, <a href=\"http:\/\/www.greytrix.com\/product\/sage-x3\/gumu-x3-salesforce-integration\" target=\"_blank\">Salesforce.com<\/a> and <a href=\"http:\/\/www.greytrix.com\/product\/magento-sage-integrations\/sage-x3-magento\" target=\"_blank\">Magento eCommerce<\/a>. It also offers best-in-class <a href=\"http:\/\/www.greytrix.com\/product\/erp-development\/sage-x3\" target=\"_blank\">Sage X3 customization and development services<\/a> to Sage business partners, end users, and Sage PSG worldwide.<\/p>\n<p style=\"text-align: justify\">For more information on Sage X3 Integration and Services, please contact us at <a href=\"mailto:x3@greytrix.com\" target=\"_blank\">x3@greytrix.com<\/a>.We will be glad to assist you.<\/p>\n<p>&nbsp;<\/p>\n<p>Related Posts:<\/p>\n<ul>\n<li><strong><a href=\"https:\/\/www.greytrix.com\/blogs\/sagex3\/2013\/11\/22\/how-to-attach-the-report-to-the-window-in-x3\/\">How to attach the Report to the Window in X3<\/a><\/strong><\/li>\n<li><strong><a href=\"https:\/\/www.greytrix.com\/blogs\/sagex3\/2013\/09\/24\/adding-crystal-report-in-x3\/\">Adding Crystal Report In X3<\/a><\/strong><\/li>\n<li><strong><a href=\"https:\/\/www.greytrix.com\/blogs\/sagex3\/2012\/07\/04\/sage-x3-reports-as-per-indian-business-standards-part-iii\/\">Sage X3 reports as per Indian Business Standards \u2013 Part III<\/a><\/strong><\/li>\n<li><strong><a href=\"https:\/\/www.greytrix.com\/blogs\/sagex3\/2012\/12\/17\/send-invoice-reports-automatically-in-sage-x3\/\">Send Invoice Reports Automatically in Sage X3<\/a><\/strong><\/li>\n<li><strong><a href=\"https:\/\/www.greytrix.com\/blogs\/sagex3\/2012\/04\/06\/sage-erp-x3-reports-india-specific-reports-part-i\/\">Sage ERP X3 Reports \u2013 India Specific Reports \u2013 Part I<\/a><\/strong><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sage X3 provides a special function Writeb to write into a table. It works similar to Write function but it allows us to optimize the performances when several insertions of database lines must be done. Syntax: Writeb Writeb[CLASS] where, CLASS: a classidentifier that corresponds to the abbreviation used to open a database table. Writeb allows\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.greytrix.com\/blogs\/sagex3\/2017\/02\/20\/optimize-the-performances-when-several-insertions-of-database-lines-must-be-done\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[1942,1945,2089,2134],"class_list":["post-9948","post","type-post","status-publish","format-standard","hentry","category-sage-erp-x3","tag-sage-x3-technical-assistance","tag-sage-x3-technical-blogs","tag-several-insertions-of-database-lines","tag-special-function-writeb"],"_links":{"self":[{"href":"https:\/\/www.greytrix.com\/blogs\/sagex3\/wp-json\/wp\/v2\/posts\/9948","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\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/sagex3\/wp-json\/wp\/v2\/comments?post=9948"}],"version-history":[{"count":0,"href":"https:\/\/www.greytrix.com\/blogs\/sagex3\/wp-json\/wp\/v2\/posts\/9948\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.greytrix.com\/blogs\/sagex3\/wp-json\/wp\/v2\/media?parent=9948"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/sagex3\/wp-json\/wp\/v2\/categories?post=9948"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/sagex3\/wp-json\/wp\/v2\/tags?post=9948"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}