[Rt-devel] SearchBuilder help needed

Ruslan Zakirov ruz at bestpractical.com
Wed Dec 3 16:03:14 EST 2008


my $ccs = RT::CCs->new($RT::SuperUser);
my $alias = $ccs->Join( FIELD1 => 'id', TABLE2 => 'CE', FIELD2 =>
'Contact', TYPE => 'LEFT' );
$ccs->Limit( ALIAS => $alias, FIELD => 'Email', VALUE => 'some' );
while ( my $cc = $ccs->Next ) {
}

something like that, a lot of examples are in RT::Tickets with some
exception that Tickets has some additional helpers for TicketSQL, but
with little changes you can still different constructions there.

I think you know that left join here is redundant and will be
downgraded to a regular join.

On Wed, Dec 3, 2008 at 5:04 PM, Agnislav Onufrijchuk
<Agnislav.Onufrijchuk at portaone.com> wrote:
> Hi all.
>
> Can you please help me with constructing query using native RT methods?
>
> I need to override Email Gateway method with adding additional check. I
> use following sql-query:
>
> select
>   CC.customer_id from CustomerContacts CC
> LEFT JOIN
>   ContactEmails CE ON (CC.id = CE.Contact_Id)
> WHERE
>   CE.Email = "some at email.com";
>
> What object should I use as base - RT::CustomerContacts or
> RT::ContactEmails? And what sequence of Join and Limit methods should I
> use?
>
> I'm new in DBIx::SearchBuilder and need a bit help to start :)
>
> --
> Agnislav Onufrijchuk
> PortaOne, Inc., RT Developer
> Tel: +1-866-SIP VOIP (+1 866 747 8647) ext. 7670
>
>   Meet us at Internet Telephony East
>   February 2-4, 2009 - Booth 826
>   Miami Beach Convention Center
> _______________________________________________
> List info: http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-devel
>



-- 
Best regards, Ruslan.


More information about the Rt-devel mailing list