Display combined fields on Output3 report [message #2702] |
Wed, 20 April 2011 12:01 |
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 |
AJM
Messages: 2368 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.
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
|
|
|
|
Re: Display combined fields on Output3 report [message #2705 is a reply to message #2704] |
Thu, 21 April 2011 13:57 |
AJM
Messages: 2368 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.
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
|
|
|