Owner Policy Type

Discussions related to Crystal Reports development.

Moderator: Lisa Ennis

Post Reply
MJA-99
Posts: 33
Joined: Fri Apr 08, 2011 2:41 pm

Owner Policy Type

Post by MJA-99 »

Presently, this is the SELECT Statement used to determine whether the Policy Type is Simultaneous, Loan, or Owners:

SELECT TOP 1 PT.ID AS PolicyTypeID
FROM
dbo.[Order] AS O
INNER JOIN dbo.Title AS TI ON O.ID = TI.OrderID
INNER JOIN dbo.Loan AS LN ON O.ID = LN.OrderID
LEFT OUTER JOIN dbo.TitleInsurancePremiumCalculation AS TIPC ON LN.ID = TIPC.LoanID AND LN.SortOrder = 1
INNER JOIN dbo.zrefPolicyType AS PT ON TIPC.PolicyTypeID = PT.ID AND PT.IsActive = 1 AND LN.SortOrder = 1
WHERE
O.IsTemplate = 0 AND O.ID = @CONTEXTID

This seems to be working for Simultaneous and Loan Policy Types yet we would like to confirm if there is a similar way to determine Owners Policy Type. Or, would that type be determined by the above returning NULL?

Thanks,

MJA
Melissa McBerkowitz
Posts: 91
Joined: Wed Sep 10, 2008 3:33 pm
Location: Raleigh, NC
Contact:

Re: Owner Policy Type

Post by Melissa McBerkowitz »

The problem is your join to the Loan table from TitleInsurancePremiumCalculation. TIPC.LoanID will be null for an owner's policy. Removing or updating those joins returns the owner's data as intended.

Side note: Title.ID is guaranteed to be the same as Order.ID, so you can join directly from Order.ID to TIPC.TitleID if you don't need to consider the Title table for any other reason.
Melissa McBerkowitz
VP of Product Strategy, SoftPro
Post Reply