Question Status

Verified
Michael_Land asked a question on 15 Mar 2013 4:56 AM

Hello All,

I have a quite Complex Report (MorphX) where I should fetch data from 8 tables. Data from tables are fetch two times mostly into Report starting from upper of report. I tried to use approach where I defined two Bodys to those Tables whose data was needed into different part of report.

BUT it doesn't work properly. E.g. when report is using second Body of certain Table data is not shown and Report's layout is going wrong. How should this kind situation should be handled?

I attach image of my Report's Body's so you understand what I have done.

Best Regards,

Micahel

Reply
Verified Answer
Jonathan Havard responded on 15 Mar 2013 9:49 AM

Michael,

Two bodies displaying data from the same table in different areas of the report does work.  Let me take a stab at what might be going wrong in your current design.

The body sections in a report will trigger every time a table is sent which matches the table property on the body section.  So, send(SalesTable) will trigger all body sections which are set to SalesTable.  Now if you haven't overridden fetch(), the send() method calls will be performed as part of fetch() in the hierarchical order of your query.

Looking at your body section, it seems you want your report format to be:

[Prod table 1]

[Sales table 1]

[Sales line 1]

[Sales table 2]

[Prod table 2]

[Sales line 2]

Assuming your query is similar to:

ProdTable join SalesTable join SalesLine,

the report is printing your sections like this:

[Prod table 1]

[Prod table 2]

[Sales table 1]

[Sales table 2]

[Sales line 1]

[Sales line 2]

If my suspicion is correct, then you can probably get it printing reasonably by changing your body sections' Table property to the bottom-most table that makes sense.  Something like:

[Prod table 1] - ProdTable

[Sales table 1] - SalesTable

[Sales line 1] - SalesLine

[Sales table 2] - SalesLine

[Prod table 2] - SalesLine

[Sales line 2] - SalesLine

The reason this will work is because at the time which SalesLine is sent, the report has access to "current" data for the data sources which are higher up in the query structure.  Since all of the lower body sections are mapped to SalesLine, they will all print at the time SalesLine is sent, and will default to the order in the AOT.

I hope this helps.

Jonathan P. Havard
Developer, Sikich Technology
Sikich LLP

Reply
Jonathan Havard responded on 15 Mar 2013 9:10 AM

Michael,

MorphX reports do support multiple body sections mapped to the same table.  Please post some pictures of the resulting output, or better yet, an XPO along with descriptions of what is not working so we can see what's going on in your specific case.  If you have overridden the fetch() method, the code there would also be useful for diagnosing your problem.

Jonathan P. Havard
Developer, Sikich Technology
Sikich LLP

Reply
Michael_Land responded on 15 Mar 2013 9:34 AM

Thank you for your reply, Jonathan!

I was also wondering that two Bodys doesn't work...

I started weekend so I haven't got source code.

But what is the right way to do this kind of data handling where "some-table" is used in the beginning or Report and the other ones and in the end this "some-table".

So, the main problem is: data from different DataSources/tables have to be in many places in the Report.

That's what I have been thinking all the day.

Best Regeards,

Michael

Reply
Michael_Land responded on 15 Mar 2013 9:39 AM

Correct my clause:

"But what is the right way to do this kind of data handling where "some-table" is used in the beginning of the Report and the other ones,and again this "some-table" in the end of Report".

Thank you!

Reply
Verified Answer
Jonathan Havard responded on 15 Mar 2013 9:49 AM

Michael,

Two bodies displaying data from the same table in different areas of the report does work.  Let me take a stab at what might be going wrong in your current design.

The body sections in a report will trigger every time a table is sent which matches the table property on the body section.  So, send(SalesTable) will trigger all body sections which are set to SalesTable.  Now if you haven't overridden fetch(), the send() method calls will be performed as part of fetch() in the hierarchical order of your query.

Looking at your body section, it seems you want your report format to be:

[Prod table 1]

[Sales table 1]

[Sales line 1]

[Sales table 2]

[Prod table 2]

[Sales line 2]

Assuming your query is similar to:

ProdTable join SalesTable join SalesLine,

the report is printing your sections like this:

[Prod table 1]

[Prod table 2]

[Sales table 1]

[Sales table 2]

[Sales line 1]

[Sales line 2]

If my suspicion is correct, then you can probably get it printing reasonably by changing your body sections' Table property to the bottom-most table that makes sense.  Something like:

[Prod table 1] - ProdTable

[Sales table 1] - SalesTable

[Sales line 1] - SalesLine

[Sales table 2] - SalesLine

[Prod table 2] - SalesLine

[Sales line 2] - SalesLine

The reason this will work is because at the time which SalesLine is sent, the report has access to "current" data for the data sources which are higher up in the query structure.  Since all of the lower body sections are mapped to SalesLine, they will all print at the time SalesLine is sent, and will default to the order in the AOT.

I hope this helps.

Jonathan P. Havard
Developer, Sikich Technology
Sikich LLP

Reply