Radicore Forum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » RADICORE » How To » Display combined fields on Output3 report (Create field and add to $fieldarray dynamically )
Display combined fields on Output3 report [message #2702] Wed, 20 April 2011 12:01 Go to next message
VitalSpark is currently offline  VitalSpark
Messages: 5
Registered: April 2011
Junior Member
I have a table 'person' The fields 'forename' and 'surname' from this are shown separately in the body section of my output3 format report.

I would like to be able to show the fields as a single concatenated name in the report but can't find a way to create the new field.

I have tried using cm_changeConfig - but probably I need the field to exist in field array first? and also tried to use cm_getExtraData to create a new entry in $fieldarray which I could then display but to no avail.

I know I could create another field in the table but that goes against good practice. I wold likje to be able to do this - and other similar operations - on the fly.

Any help much appreciated.
Re: Display combined fields on Output3 report [message #2703 is a reply to message #2702] Thu, 21 April 2011 01:28 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2347
Registered: April 2006
Location: Surrey, UK
Senior Member
In order to display a field it must appear in the report definition and it must appear in te XML output.

Modifying cm_changeConfig does not sound right to me. If you want to create a new field which concatenates the contents of two or more other fields, or make any other modifications to a field before it is displayed, then the best place for this is would be the _cm_post_getData method. This will allow you to change the contents of $fieldarray just after each record has been read.

Another way wold be to perform the concatenation within the sql SELECT statement.


Re: Display combined fields on Output3 report [message #2704 is a reply to message #2703] Thu, 21 April 2011 09:24 Go to previous messageGo to next message
VitalSpark is currently offline  VitalSpark
Messages: 5
Registered: April 2011
Junior Member
Thanks.

I ended up editing $sql_select.

I had tried modifying the _cm_post_getData method but this apparently isn't being called for/by the new class (person_report) that I have defined for my report, despite having this in the class.inc file. Also, std.output3.inc seems to use the base table (person) for its data.

Anyway, it's working now.
Re: Display combined fields on Output3 report [message #2705 is a reply to message #2704] Thu, 21 April 2011 13:57 Go to previous message
AJM is currently offline  AJM
Messages: 2347
Registered: April 2006
Location: Surrey, UK
Senior Member
std.output3.inc does not have any hard-coded references to any classes - they are passed down to it from the transaction script. If it loads the wrong class it is because it has be told to load the wrong class.

In order for the _cm_post_getData method in the person_report class to be called the transaction must reference person_report.class.inc and not person.class.inc. If you stepped through with your debugger you would see exactly why the expected class was not being loaded and the expected method was not being called.


Previous Topic: RIGHT JOIN in LINK
Next Topic: Access non key data from parent table
Goto Forum:
  


Current Time: Thu Mar 28 12:59:53 EDT 2024

Total time taken to generate the page: 0.01042 seconds