Quantcast
Channel: Sage X3 – Tips, Tricks and Components
Viewing all articles
Browse latest Browse all 1528

Executing a sql query using 4GL language

$
0
0

There are many a time when we need to get the aggregate or maximum function but 4GL Language do not offers 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:

Format:

Local char REQSTR(250)(10)

For [Table name] where document no

REQSTR(0) = “SQL query ”

For fields_0 from Databasetyp Sql REQSTR(0…10) as tablename

Databasetyp: it is a database type for this we have create function so it will identify that current database uses by X3 server

 We have applied this with example.

 Local Char REQSTR(250)(10)

    For [Z3T] Where 1=1

     For [ZQRY] Where DOCNO = [F:Z3T]DOCNO

         REQSTR(0) = “SELECT DOCDATE_0, QRNO_0 FROM ZETIQUERY WHERE ROWID      =”+num$([F:ZQRY]       ROWID)+”"

                 For (Date DOCDATE, Char QRNO) From func GETDBTYP  Sql REQSTR(0..10) As [ZYOP]

                          Update [Z3T] Where DOCNO = [ZQRY]DOCNO With DOCDATE = [F:ZYOP]DOCDATE

                        Update [Z3T] Where DOCNO = [ZQRY]DOCNO With QRNO = [F:ZYOP]QRNO

                        Update [Z3T] Where DOCNO = [ZQRY]DOCNO With MARK = 2

                  Next        

     Next

  Next


Viewing all articles
Browse latest Browse all 1528

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>