Home RAP
New Blog Posts: Merging Reports - Part 1 and Part 2

Query update before a group break..

edited September 2009 in RAP
Hi,
I'm printing a pipeline groupped by one field.
This field is a numeric code and I would to lookup with another field
from anotehr table.
for example:


State ITA
row 1
row 2
.
.
.
State USA
row 1
row 2
.
.



and I would to lookup ITA reading another table like this:
ITA Italia
USA United State of America
.
.
.


I have written this code in Group1BeforeGroupBreak:

var
lSQLBuilder: TdaSQLBuilder;
begin

lSQLBuilder := TdaSQLBuilder.Create(Fasi_Lavorative);
lSQLBuilder.Sql.SqlText.Text := 'SELECT * FROM FasiLavorative Where
CODICE = ' + Group1.BreakValue;

lSQLBuilder.ApplyUpdates;

lSQLBuilder.Free;

end;

-----------------------------

I have tried to assign in the code a memo:

memoFaseLav.text := Fasi_Lavorative['Descrizione_lunga'];

or

put a DBEDIT on the report linked to pipeline and datafield but it is
always blank...

What must I do please?

Thanks!

Dario

Comments

  • edited September 2009
    Hi Dario,

    My first suggestion would be to get this working in Delphi before moving it
    to RAP code. This way you can trace into the BeforeGroupBreak event and see
    if the query you are using actually returns any values. It seems that the
    search criteria assigned is filtering out all values or the break value is
    not getting assigned properly.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited September 2009

    In general, you cannot modify the SQL while the report is generating.

    The solution is to model the data access to support your requirements.

    Some options:

    1. In the query, perform a SQL join to link in the lookup data.

    or

    2. Create a Lookup query that contains the country code and country name
    fields. Then link the Lookup query to the Main query by selecting the
    country code field from the Lookup dataview windows and dragging it to the
    to country code field in the Main query dataview.




    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.