SQL Syntax for DBF with harbour / HMG ?

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
AUGE_OHR
Posts: 2117
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

SQL Syntax for DBF with harbour / HMG ?

Post by AUGE_OHR »

hi,

is it possible to use SQL Syntax for DBF with harbour / HMG :?:

i know i can do it with ODBC or ADO to access DBF and use SQL Syntax.
is there another Way to use SQL Syntax with DBF :idea:
have fun
Jimmy
User avatar
AUGE_OHR
Posts: 2117
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: SQL Syntax for DBF with harbour / HMG ?

Post by AUGE_OHR »

here a Sample how i like to use SQL Syntax using Array

Code: Select all

PROCEDURE Main()
        LOCAL aKtoSum := {}
        LOCAL aKto := { ;
                {"Konto1   1000",          10},;
                {"Konto1   1000",           2},;
                {"Konto1   1000",         399},;
                {"Konto2   1010",          34},;
                {"Konto3   3000",           2},;
                {"Konto4   4000",        6555},;
                {"Konto5   8100",           6},;
                {"konto1   1000",          34},;
                {"Konto3   3000",          77 }}
 
   SELECT field1 AS konto, SUM( field2 ) AS Summe FROM ( aKto ) GROUP BY konto ORDER BY Summe DESC INTO ARRAY aKtoSum
   ? VAR2CHAR( aKtoSum )  // hb_valToExp()
   WAIT
RETURN 
have fun
Jimmy
User avatar
gfilatov
Posts: 1116
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Contact:

Re: SQL Syntax for DBF with harbour / HMG ?

Post by gfilatov »

AUGE_OHR wrote: Tue Mar 22, 2022 11:36 pm hi,

is it possible to use SQL Syntax for DBF with harbour / HMG :?:

i know i can do it with ODBC or ADO to access DBF and use SQL Syntax.
is there another Way to use SQL Syntax with DBF :idea:
Hi Jimmy,

Thanks for your interest :!:

It is possible with using a small Selector library in the MiniGUI Ex. 8-)

For, example, take a look for the following test report program:
#include "hmg.ch"
#include "Selector.ch"

declare window Main

Function main_button_1_action

Use Test Alias Source

@ SELECT CODE, FIRST, LAST, COUNTRY GROUP, SALARY FROM Source FOR "C" $ COUNTRY .OR. COUNTRY = 'Mexico' ALIAS Test

LOAD REPORT Test

EXECUTE REPORT Test PREVIEW SELECTPRINTER

Close Databases
dbDrop( "temp" )

Return Nil
You nay review the result in the attached PDF :arrow:

Hope that useful :idea:
Attachments
report_test.7z
Report result in the PDF format
(271.86 KiB) Downloaded 157 times
Kind Regards,
Grigory Filatov

"Everything should be made as simple as possible, but no simpler." Albert Einstein
Post Reply