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 »

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: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: GRID - OnQueryData

Post by Rathinagiri »

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: 816
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Location: Canada

Re: GRID - OnQueryData

Post by franco »

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]
All The Best,
Franco
Canada
User avatar
dragancesu
Posts: 920
Joined: Mon Jun 24, 2013 11:53 am
DBs Used: DBF, MySQL, Oracle
Location: Subotica, Serbia

Re: GRID - OnQueryData

Post by dragancesu »

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

Re: GRID - OnQueryData

Post by dreptus »

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: 3161
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: GRID - OnQueryData

Post by serge_girard »

Rafat,

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

Serge
There's nothing you can do that can't be done...
User avatar
mol
Posts: 3718
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: GRID - OnQueryData

Post by mol »

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

Re: GRID - OnQueryData

Post by dreptus »

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 229 times
User avatar
mol
Posts: 3718
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: GRID - OnQueryData

Post by mol »

You must attach libeay.dll and libiconv-2.dll
User avatar
mol
Posts: 3718
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: GRID - OnQueryData

Post by mol »

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