I have a report that needs information from two different source views. (One field that I need is on the company view, while the remaining fields reside in the Opp summary.)
I believe I would have to tweak the SQL view used to grab the data for the oppo source view to include the field from the company view. Anyone have the steps to do that?
Thanks!
OK, here is the script that needs to be tweaked:
CREATE VIEW vReportOpportunity AS
SELECT RTRIM(ISNULL(Pers_FirstName, '')) + ' ' + RTRIM(ISNULL(Pers_LastName,
'')) AS Pers_FullName, RTRIM(ISNULL(Comp_PhoneCountryCode, '')) + ' ' +
RTRIM(ISNULL(Comp_PhoneAreaCode, '')) + ' ' + RTRIM(ISNULL(Comp_PhoneNumber,
'')) AS Comp_PhoneFullNumber, RTRIM(ISNULL(Comp_FaxCountryCode, '')) + ' ' +
RTRIM(ISNULL(Comp_FaxAreaCode, '')) + ' ' + RTRIM(ISNULL(Comp_FaxNumber, '')) AS
Comp_FaxFullNumber, RTRIM(ISNULL(Pers_PhoneCountryCode, '')) + ' ' +
RTRIM(ISNULL(Pers_PhoneAreaCode, '')) + ' ' + RTRIM(ISNULL(Pers_PhoneNumber,
'')) AS Pers_PhoneFullNumber, RTRIM(ISNULL(Pers_FaxCountryCode, '')) + ' ' +
RTRIM(ISNULL(Pers_FaxAreaCode, '')) + ' ' + RTRIM(ISNULL(Pers_FaxNumber, '')) AS
Pers_FaxFullNumber, Opportunity.*, Comp_Name, Comp_Territory, Comp_EmailAddress,
Comp_CompanyId, Comp_SecTerr, Comp_CreatedBy, Comp_PrimaryUserID, Terr_Caption,
Pers_Title, Pers_EmailAddress, Pers_SecTerr, Pers_CreatedBy, Pers_PersonId,
Pers_PrimaryUserID, Chan_Description, Comp_ChannelID,(SELECT
CAST(CAST(Parm_Value AS NCHAR) AS INTEGER) FROM Custom_SysParams WHERE Parm_Name
= 'BaseCurrency') AS Oppo_WeightedForecast_CID, Pers_ChannelID, ((Oppo_Forecast
/ Oppo_Forecast_Currency.Curr_Rate) * Oppo_Certainty / 100) AS
Oppo_WeightedForecast, Oppo_PrimaryAccountId AS Acc_AccountId FROM Opportunity
LEFT JOIN vPersonPE ON Oppo_PrimaryPersonID = Pers_PersonID LEFT JOIN vCompanyPE
ON Oppo_PrimaryCompanyID = Comp_CompanyId LEFT JOIN Territories ON Oppo_SecTerr
= Terr_TerritoryId LEFT JOIN Channel ON Chan_ChannelId = Oppo_ChannelId LEFT
JOIN Currency Oppo_Forecast_Currency ON Oppo_Forecast_CID =
Oppo_Forecast_Currency.Curr_CurrencyID WHERE Oppo_Deleted IS NULL
The field I need to add to the view is comp_sector
Any help as to how to insert this in the code woudl be greatly appreciated. I don't want to mess it up.
Again, thanks for your help.