Dataset for two tables

Posted by Miguel Neves on 07-Sep-2017 04:53

Hi!

I´m trying to show in a radGridview the data of two tables using this code:

DEFINE TEMP-TABLE ttConc LIKE tg_conc.
DEFINE TEMP-TABLE ttFreg LIKE tg_freg.

DEFINE DATASET dsConcFreg FOR ttConc, ttFreg.

DEFINE DATA-SOURCE srcFreg FOR tg_freg.
DEFINE DATA-SOURCE srcConc FOR tg_conc.

DATA-SOURCE srcFreg:QUERY:QUERY-PREPARE(DATA-SOURCE srcFreg:QUERY:PREPARE-STRING + " where distr_cod = " + entry(1,self:private-data) +
" and conc_cod = " + entry(2,self:private-data)).
BUFFER ttFreg:ATTACH-DATA-SOURCE(DATA-SOURCE srcFreg:HANDLE).
BUFFER ttConc:ATTACH-DATA-SOURCE(DATA-SOURCE srcConc:HANDLE).

DEFINE VARIABLE grid AS TesteGrid NO-UNDO.
DEFINE VARIABLE bindingSource1 AS Progress.Data.BindingSource NO-UNDO.

DATASET dsConcFreg:FILL().

bindingSource1 = NEW Progress.Data.BindingSource().

bindingSource1:Handle = DATASET dsConcFreg:HANDLE.

grid = NEW TesteGrid(bindingSource1).
grid:show().

This code only show the data from the first table refered in the dataset, I tried with:

 DATA-RELATION drelCustOrd FOR ttFreg, ttConc 
 RELATION-FIELDS(distr_cod, distr_cod,conc_cod, conc_cod).

but it didn´t work.

Any help or idea? 

In the image at left are the columns from de first table and in the right the second (only one).

THX.

All Replies

This thread is closed