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

Search on Fieldnames inside external joined tables

Hello,
I Have delphi version XE Version 15.0.3953.35171 and ReportBuilder Version 14.08
I want to launch a report from my delphi code
The SQL in my main pipeline is something like that =

Select *
...
FROM INVOICE INVOICE_1
LEFT OUTER JOIN STOREHUGETOTAL STOREHUGETOTAL_1 ON
(STOREHUGETOTAL_1.HTTINVOICENUMBER = INVOICE_1.INVINVOICENUMBER)
AND (STOREHUGETOTAL_1.HTTNOSOCAUX = INVOICE_1.INVNOSOCAUX)
LEFT OUTER JOIN STORESTATE STORESTATE_1 ON
(STORESTATE_1.SSTIDSTATE_GESTCOM = STOREHUGETOTAL_1.HTTIDSTATE_GESTCOM)
LEFT OUTER JOIN STOREHUGETOTAL STOREHUGETOTAL_2 ON
(STOREHUGETOTAL_2.HTTIDSTATE_GESTCOM = STORESTATE_1.SSTIDSTATE_GESTCOM)
AND (STOREHUGETOTAL_2.HTTTYPE = 'DAILY')
LEFT OUTER JOIN STORESTATE STORESTATE_2 ON
(STORESTATE_2.SSTIDSTATE_GESTCOM = STORESTATE_1.SSTGROUPEDBYSTORESTATE_GESTCOM)
LEFT OUTER JOIN STOREHUGETOTAL STOREHUGETOTAL_3 ON
(STOREHUGETOTAL_3.HTTIDSTATE_GESTCOM = STORESTATE_2.SSTIDSTATE_GESTCOM)
LEFT OUTER JOIN STORESTATE STORESTATE_3 ON
(STORESTATE_3.SSTIDSTATE_GESTCOM = STORESTATE_2.SSTGROUPEDBYSTORESTATE_GESTCOM)
LEFT OUTER JOIN STOREHUGETOTAL STOREHUGETOTAL_4 ON
(STOREHUGETOTAL_4.HTTIDSTATE_GESTCOM = STORESTATE_3.SSTIDSTATE_GESTCOM)
...

The thing to see is that the sames tables are joined more than once, so there are suffixed _1, _2, _3 and so on (the is the default behavior of the report builder designer)

In my code when I want to filter on a field SSTIDSTATE_GESTCOM inside STORESTATE,

I do it with a TFiltreReport Object = SSTIDSTATE_GESTCOM , soEqual ,
In fact, it translates STORESTATE_1.SSTIDSTATE_GESTCOM =

But when I want to do something like that
TFiltreReport Object = STORESTATE_2.SSTIDSTATE_GESTCOM , soEqual ,
or
TFiltreReport Object = SSTIDSTATE_GESTCOM _2 , soEqual ,

it does not recognize the fieldname, and it skips the filter criteria

Is it possible to specify the table name or the exact alias of a fieldname inside the property Fieldname of the TFiltreReport ?

Best regards,
David




Comments

Sign In or Register to comment.