{"id":4060,"date":"2013-11-22T11:24:03","date_gmt":"2013-11-22T11:24:03","guid":{"rendered":"http:\/\/www.greytrix.com\/blogs\/sagex3\/?p=4060"},"modified":"2024-07-01T09:41:27","modified_gmt":"2024-07-01T09:41:27","slug":"executing-a-sql-query-using-4gl-language","status":"publish","type":"post","link":"https:\/\/www.greytrix.com\/blogs\/sagex3\/2013\/11\/22\/executing-a-sql-query-using-4gl-language\/","title":{"rendered":"Executing an SQL Query Using 4GL Language"},"content":{"rendered":"<p>There are many a time when we need to get the aggregate or maximum function but 4GL Language does not offer a syntax for the same.<br \/>\nBut we definitely have an option to use SQL queries in 4GL and this does the most of the job for us.<\/p>\n<p>Just go through the statements mentioned below:<\/p>\n<p><strong><span style=\"text-decoration: underline;\">Format:<\/span><\/strong><\/p>\n<p><em>Local char REQSTR(250)(10)<\/em><\/p>\n<p><em>For [Table name] where document no<\/em><\/p>\n<p><em>REQSTR(0) = \u201cSQL query \u201d<\/em><\/p>\n<p><em>For fields_0 from Databasetyp Sql REQSTR(0\u202610) as tablename<\/em><\/p>\n<p><em>Databasetyp: it is a database type for this we have create function so it will identify that current database uses by X3 server<\/em><\/p>\n<p><em>We have applied this with example.<\/em><\/p>\n<p><em>Local Char REQSTR(250)(10)<\/em><\/p>\n<p><em>For [Z3T] Where 1=1<\/em><\/p>\n<p><em>For [ZQRY] Where DOCNO = [F:Z3T]DOCNO<\/em><\/p>\n<p><em>REQSTR(0) = &#8220;SELECT DOCDATE_0, QRNO_0 FROM ZETIQUERY WHERE ROWID\u00a0\u00a0\u00a0\u00a0 \u00a0=&#8221;+num$([F:ZQRY]\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ROWID)+&#8221;&#8221;<\/em><\/p>\n<p><em>For (Date DOCDATE, Char QRNO) From func GETDBTYP\u00a0 Sql REQSTR(0..10) As [ZYOP]<\/em><\/p>\n<p><em>Update [Z3T] Where DOCNO = [ZQRY]DOCNO With DOCDATE = [F:ZYOP]DOCDATE<\/em><\/p>\n<p><em>Update [Z3T] Where DOCNO = [ZQRY]DOCNO With QRNO = [F:ZYOP]QRNO<\/em><\/p>\n<p><em>Update [Z3T] Where DOCNO = [ZQRY]DOCNO With MARK = 2<\/em><\/p>\n<p><em>Next<\/em><\/p>\n<p><em>Next<\/em><\/p>\n<p><em>Next<\/em><\/p>\n<p><span style=\"font-size: Medium;\"><strong>About Us<\/strong><\/span><br \/>\n<a href=\"https:\/\/www.greytrix.com\/\">Greytrix<\/a> \u2013 a globally recognized Premier Sage Gold Development Partner is a one-stop solution provider for Sage ERP and Sage CRM needs. Being recognized and rewarded for multi-man years of experience, we bring 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><a href=\"https:\/\/www.greytrix.com\/\">Greytrix<\/a>\u00a0caters to a wide range of Sage Enterprise Management (Sage X3) offerings \u2013 a Sage Business Cloud Solution. Our\u00a0unique GUMU&#x2122; integrations include <a href=\"https:\/\/www.greytrix.com\/product\/sage-crm\/gumu-sage-x3-integration\">Sage Enterprise Management (Sage X3) for Sage CRM<\/a>,\u00a0<a href=\"https:\/\/www.greytrix.com\/product\/sage-x3\/gumu-x3-salesforce-integration\">Salesforce.com<\/a> and\u00a0<a href=\"https:\/\/www.greytrix.com\/product\/magento-sage-integrations\/sage-x3-magento\">Magento eCommerce<\/a>\u00a0along with Implementation and Technical Support worldwide for <a href=\"https:\/\/www.greytrix.com\/africa\/product\/consulting\/implementation-planning\">Sage Enterprise Management (Sage X3)<\/a>. Currently we are <a href=\"https:\/\/www.greytrix.com\/africa\">Sage Enterprise Management Implementation Partner<\/a> in East Africa, Middles East, Australia, Asia.\u00a0We also offer best-in-class\u00a0<a href=\"https:\/\/www.greytrix.com\/product\/erp-development\/sage-x3\">Sage X3 customization and development services<\/a>,\u00a0integrated applications such as <a href=\"https:\/\/www.greytrix.com\/product\/sage-enterprise-management-integration-services\/pos-system\">POS<\/a> | <a href=\"https:\/\/www.greytrix.com\/product\/sage-enterprise-management-integration-services\/warehouse-management-system\">WMS<\/a> | <a href=\"https:\/\/www.greytrix.com\/product\/sage-enterprise-management-integration-services\/payment-gateway\">Payment Gateway<\/a> | <a href=\"https:\/\/www.greytrix.com\/product\/sage-enterprise-management-integration-services\/shipping-system\">Shipping System<\/a> | <a href=\"https:\/\/www.greytrix.com\/product\/sage-enterprise-management-integration-services\/business-intelligence\">Business Intelligence<\/a> | <a href=\"https:\/\/www.greytrix.com\/product\/sage-x3\/ecommerce-magento-integration\">eCommerce<\/a> and have developed add-ons such as <a href=\"https:\/\/www.greytrix.com\/product\/sage-enterprise-management-add-ons\/catch-weight\">Catch \u2013 Weight <\/a>\u00a0and <a href=\"https:\/\/www.greytrix.com\/product\/sage-enterprise-management-add-ons\/letter-of-credit\">Letter of Credit<\/a> for Sage Enterprise Management to Sage business partners, end users and Sage PSG worldwide.<\/p>\n<p>Greytrix is a recognized <a href=\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2017\/07\/26\/greytrix-on-boards-sage-global-rockstar-isv-program-with-gumu-for-sage-crm-sage-x3-solution\/\">Sage Rockstar ISV Partner<\/a> for GUMU&#x2122; Sage Enterprise Management \u2013 Sage CRM integration also listed on <a href=\"https:\/\/www.sage.com\/marketplace\/asb_ListingDetail?listingId=a1h24000007PC3aAAG\" target=\"_blank\" rel=\"noopener\">Sage Marketplace<\/a>; GUMU&#x2122; integration for Sage Enterprise Management \u2013 Salesforce is a 5-star app listed on <a href=\"https:\/\/appexchange.salesforce.com\/listingDetail?listingId=a0N30000000psM5EAI\" target=\"_blank\" rel=\"noopener\">Salesforce AppExchange<\/a>.<\/p>\n<p>For more information on Sage X3 Integration and Services, please contact us at\u00a0<a href=\"mailto:x3@greytrix.com\">x3@greytrix.com<\/a>. We will be glad to assist you.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>There are many a time when we need to get the aggregate or maximum function but 4GL Language does not offer a syntax for the same. But we definitely have an option to use SQL queries in 4GL and this does the most of the job for us. Just go through the statements mentioned below:\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.greytrix.com\/blogs\/sagex3\/2013\/11\/22\/executing-a-sql-query-using-4gl-language\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[20,2143,2310],"class_list":["post-4060","post","type-post","status-publish","format-standard","hentry","category-configuration","tag-4gl","tag-sql-query","tag-update"],"_links":{"self":[{"href":"https:\/\/www.greytrix.com\/blogs\/sagex3\/wp-json\/wp\/v2\/posts\/4060","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=4060"}],"version-history":[{"count":3,"href":"https:\/\/www.greytrix.com\/blogs\/sagex3\/wp-json\/wp\/v2\/posts\/4060\/revisions"}],"predecessor-version":[{"id":29479,"href":"https:\/\/www.greytrix.com\/blogs\/sagex3\/wp-json\/wp\/v2\/posts\/4060\/revisions\/29479"}],"wp:attachment":[{"href":"https:\/\/www.greytrix.com\/blogs\/sagex3\/wp-json\/wp\/v2\/media?parent=4060"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/sagex3\/wp-json\/wp\/v2\/categories?post=4060"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/sagex3\/wp-json\/wp\/v2\/tags?post=4060"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}