On Jun 22, 2007, at 6:27 PM, James Masters wrote:
> Basic question.
> As with all database work, when I write a report, sometimes I need
> to show a
> column which is not a field but is calculated on the fly from
> fields in the
> database.
>
> Does Rose facilitate such "display-only" fields in some way?
>
> Thought it was worth asking if there was a "correct" way to do it
> before I
> did my own thing...
write a function in the rose class....
i like to use the prefix F_ so i know that its a function.
if i use inherited functions or mixins, i'll adjust the prefix
accordingly, so i can figure out what the class is by just looking at
the name
package Myapp::RoseDB::Object::Table;
use Myapp::RoseDB::Object();
use base qw(Myapp::RoseDB::Object);
__PACKAGE__->meta->setup();
sub F_display_only_a {
my ($self)= @_;
return sprintf( "%s || %s || %s " , $self->id , $self->ip , $self-
>timestamp_created );
}
sub F_display_only_b {
my ($self)= @_;
return $self->{'com.2xlp'}{'F_display_only_b'} if defined $self->
{'com.2xlp'}{'F_display_only_b'} ;
$self->{'com.2xlp'}{'F_display_only_b'}= ( $self->id * 3.1417 ) * 2;
return $self->{'com.2xlp'}{'F_display_only_b'};
}
// Jonathan Vanasco
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
| CEO/Founder SyndiClick Networks
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
| Founder/CTO/CVO
| FindMeOn.com - The cure for Multiple Web Personality Disorder
| Web Identity Management and 3D Social Networking
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
| RoadSound.com - Tools For Bands, Stuff For Fans
| Collaborative Online Management And Syndication Tools
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Rose-db-object mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rose-db-object