GRID - OnQueryData

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

dreptus
Posts: 7
Joined: Tue Jun 14, 2011 12:06 pm
DBs Used: DBF,PostgreSQL,MySQL

GRID - OnQueryData

Post by dreptus » Fri Dec 08, 2017 1:47 pm

Hi All

I'm trying to change data source from DBF to postgresql using (virtual grid)
I have connection to postgresql via RDD.

Source of data is result of the query.

oQuery:- .....
aTable:=PQRESULT2ARRAY(oQuery:pQuery)

Function onsqlquery
This.QueryData := aTable[This.QueryRowIndex] [This.QueryColIndex]
Return Nil

In object inspector - bookmark "function" of the grid control
OnQueryData onsqlquery()

All working properly.
DoubleClick on row in grid returns correct value (for example: 10)


The problem appears when i try to locate and highlight (to point) correct row in a grid assigning value.
ControlName.GridName.value:=10

Result

Date:2017.12.06 Time: 14:54:44
Error BASE/1132 Error range of array: incorect number of arguments

Called from ONSQLQUERY(1583)
Called from (b)QHASLA(425)
Called from EVENTS(3049)
Called from C_MSGSTOP(0)
Called from SHOWERROR(181)
Called from DEFERROR(129)
Called from (b)ERRORSYS(66)
Called from ONSQLQUERY(1583)
Called from (b)QHASLA(425)
Called from EVENTS(3049)
Called from C_MSGSTOP(0)
Called from SHOWERROR(181)
Called from DEFERROR(129)
Called from (b)ERRORSYS(66)
Called from ONSQLQUERY(1583)
Called from (b)QHASLA(425)
Called from EVENTS(3049)
Called from C_MSGSTOP(0)
Called from SHOWERROR(181)
Called from DEFERROR(129)
Called from (b)ERRORSYS(66)
Called from ONSQLQUERY(1583)
Called from (b)QHASLA(425)
Called from EVENTS(3049)
Called from C_MSGSTOP(0)
Called from SHOWERROR(181)
Called from DEFERROR(129)
Called from (b)ERRORSYS(66)
Called from ONSQLQUERY(1583)
Called from (b)QHASLA(425)
Called from EVENTS(3049)
Called from DOMESSAGELOOP(0)
Called from _ACTIVATEWINDOW(5702)
Called from DOMETHOD(9003)
Called from QHASLA(16)
Called from HB_EXECFROMARRAY(0)
Called from (b)MAIN(161)
Called from _DOCONTROLEVENTPROCEDURE(6041)
Called from EVENTS(1741)
Called from DOMESSAGELOOP(0)
Called from _ACTIVATEWINDOW(5702)
Called from DOMETHOD(9003)
Called from QWSTEP_LOGOWANIE(273)
Called from WSTEP(712)
Called from SPLASHDELAY(1045)
Called from (b)SPLASH(4)
Called from _PROCESSINITPROCEDURE(5861)
Called from _ACTIVATEWINDOW(5689)
Called from DOMETHOD(9003)
Called from SPLASH(1035)
Called from (b)MAIN(4)
Called from _PROCESSINITPROCEDURE(5861)
Called from _ACTIVATEWINDOW(5612)
Called from DOMETHOD(9003)
Called from MAIN(631)


It is possible to point (highlight) correct row in virtual grid assigning value or other way ?

Regards/Saludos
Rafał

User avatar
Rathinagiri
Posts: 5210
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 155 times
Been thanked: 144 times
Contact:

Post by Rathinagiri » Fri Dec 08, 2017 2:46 pm

Can you post a simple sample? Without any database? Only array?
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.

franco
Posts: 246
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Been thanked: 9 times

Post by franco » Sat Dec 09, 2017 12:10 am

I do not know if this is will work with what you are doing.
In hmg3.44 I found the table does not follow the grid so whenever I want to set the table row to the grid row
I select the table and put in line
go ControlName.GridName.recno
this sets the table to the grid and they are in sync again
if this does not work
then maybe you have to reuse this statement ? This.QueryData := aTable[This.QueryRowIndex] [This.QueryColIndex]

User avatar
dragancesu
Posts: 542
Joined: Mon Jun 24, 2013 11:53 am
DBs Used: DBF, MySQL, Oracle
Location: Subotica, Serbia
Has thanked: 11 times
Been thanked: 97 times

Post by dragancesu » Sat Dec 09, 2017 4:53 am

Franco, it's simple

1. access the database
2 reads rows and writes to the grid
3. then wants to change the data, insert, update or delete, and it needs to know which line changes

here is the question and structure of the table in the database
but the problem is that we only see a program fragment, not all

dreptus
Posts: 7
Joined: Tue Jun 14, 2011 12:06 pm
DBs Used: DBF,PostgreSQL,MySQL

Post by dreptus » Sun Dec 10, 2017 2:11 pm

Thanks for your answers
You're right.

Becouse this is a part of a very big working project i have to prepare sample to show the problem in short prg.

Regards

User avatar
serge_girard
Posts: 2045
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Has thanked: 404 times
Been thanked: 89 times
Contact:

Post by serge_girard » Sun Dec 10, 2017 2:19 pm

Rafat,

Please try with ControlName.GridName.value:= {n ,1} where n is your index.

Serge

User avatar
mol
Posts: 2985
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Has thanked: 160 times
Been thanked: 85 times
Contact:

Post by mol » Sun Dec 10, 2017 5:16 pm

serge_girard wrote:
Sun Dec 10, 2017 2:19 pm
Rafat,

Please try with ControlName.GridName.value:= {n ,1} where n is your index.

Serge
This code is right to the situation when grid has declared CellNavigation property as true...

Without small sample it's very hard to help you, Rafał

dreptus
Posts: 7
Joined: Tue Jun 14, 2011 12:06 pm
DBs Used: DBF,PostgreSQL,MySQL

Post by dreptus » Mon Dec 11, 2017 9:15 pm

Hi

I wrote a sample to show the problem.
I created database name "grid" in public shema of postgresql and the table gridtest

Host := "localhost"
Database := "grid"
User := "postgres"
Passwd := "postgres"


CREATE TABLE public.gridtest
(
id integer NOT NULL DEFAULT nextval('gridtest_id_seq'::regclass),
name character varying(100)
)
WITH (
OIDS=FALSE
);
ALTER TABLE public.gridtest
OWNER TO postgres;


I added 3 records and run sample and ??????

Everything was fine and worked properly.

I don't know why i have a problem in my project (yet).
Maybe some variables are similar and rewrited each other.

Working sample in attachment.
Thank you all for your help.
I'm going to work.

Regards / Saludos/ Pozdrowienia


"La hora mas oscura es justo antes del amanecer"
Attachments
GRID.ZIP
(1.49 MiB) Downloaded 55 times

User avatar
mol
Posts: 2985
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Has thanked: 160 times
Been thanked: 85 times
Contact:

Post by mol » Tue Dec 12, 2017 6:50 am

You must attach libeay.dll and libiconv-2.dll

User avatar
mol
Posts: 2985
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Has thanked: 160 times
Been thanked: 85 times
Contact:

Post by mol » Tue Dec 12, 2017 6:53 am

dreptus wrote:
Mon Dec 11, 2017 9:15 pm
I added 3 records and run sample and ??????

Everything was fine and worked properly.

I don't know why i have a problem in my project (yet).
Maybe some variables are similar and rewrited each other.
Sometimes you need to spend whole day or week looking for small error :)
IMHO, if your sample works OK, you must watch over your code.

Post Reply