Page 1 of 2

GRID - OnQueryData

Posted: Fri Dec 08, 2017 1:47 pm
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ł

Re: GRID - OnQueryData

Posted: Fri Dec 08, 2017 2:46 pm
by Rathinagiri
Can you post a simple sample? Without any database? Only array?

Re: GRID - OnQueryData

Posted: Sat Dec 09, 2017 12:10 am
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]

Re: GRID - OnQueryData

Posted: Sat Dec 09, 2017 4:53 am
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

Re: GRID - OnQueryData

Posted: Sun Dec 10, 2017 2:11 pm
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

Re: GRID - OnQueryData

Posted: Sun Dec 10, 2017 2:19 pm
by serge_girard
Rafat,

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

Serge

Re: GRID - OnQueryData

Posted: Sun Dec 10, 2017 5:16 pm
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ł

Re: GRID - OnQueryData

Posted: Mon Dec 11, 2017 9:15 pm
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"

Re: GRID - OnQueryData

Posted: Tue Dec 12, 2017 6:50 am
by mol
You must attach libeay.dll and libiconv-2.dll

Re: GRID - OnQueryData

Posted: Tue Dec 12, 2017 6:53 am
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.