I need to get this working and cannot figure out where my error is. This 
code:

sub list :Local {
        my ($self, $c, $page) = @_;
        $page = $c->req->param('page') || 1;
        my $rs = $c->model('ORANGES::Account')->search_rs(undef, { 
                '+select' => [ "case when sunset_date is not null then 
'Sunset'
                                            when approval_date is not null 
then 'Complete'
                                        when approval_date is null then
                                        case when g.percent_complete < 100 

                                                then 'Pending 
Installation'
                                        else 'Pending Approval'
                                        end
                                end" ], 
                '+as' => [ 'account_status' ], 
                order_by => 'account_code',
                prefetch => {
                        account_id => 'progress',
                        account_id => 'metrics',
                        account_id => 'compliance',
                        department_id => 'department_id',
                },
                rows => 15,
                page => $page,
         });
        $c->stash(accounts => $rs);
        $c->stash(pager => $rs->pager());
        $c->stash(status => "");
        $c->stash->{'template'}=>'accountview/list';
}

adds the case statement to the sql, but I get an error that "sunset_date" 
is ambiguous. If I specify it as "account.sunset_date" I get 
"account.sunset_date is invalid in the context it is being used in."

I don't know what it wants.

_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[email protected]

Reply via email to