Quantcast
Viewing all articles
Browse latest Browse all 20

Re: dynamic Filter ( Using multiple drop down list)

Hello Wim, I really appreciate your respond. I am completely stuck. I am providing you my source code and if you please please tell where I could make changes to make it works. I would really appreciate that.  So my current source code is working dynamically for a single select. Now, I am stuck how to change drop down list from single to multiple select. and then stored procedures

Here is my Aspx.default file (I included only the part that you could look at

<table id="tblCampaignList" border="0" cellpadding="3" class="auto-style2">
<tr>
<td style="background-color: #5D7B9D; font-size: medium; font-weight: bold; color: white; width: 100px">
Campaigns:
</td>

<td>
<asp:DropDownList ID="ddlCampaigns" runat="server" TabIndex="6"
AutoPostBack="True" onselectedindexchanged="ddlCampaigns_SelectedIndexChanged">  // when I choose a campaign here should the drop down below populate based on the selection.//
</asp:DropDownList>
</td>
<td style="background-color: #5D7B9D; font-size: medium; font-weight: bold; color: white; width: 100px">Segment: // I want this one to be changed to multiple selection//
</td>
<td>
<asp:DropDownList ID="ddlSegments" runat="server" TabIndex="7">
</asp:DropDownList>
</td>
<!-- start here -->
<td style="background-color: #5D7B9D; font-size: medium; font-weight: bold; color: white; " class="auto-style1">Download Description:
</td>
</tr>
</table>

Default.cs file

protected DropDownList ddlCampaigns;
protected DropDownList ddlSegments;

protected void ddlCampaigns_SelectedIndexChanged(object sender, EventArgs e)
{
if (this.ddlCampaigns.SelectedItem.Text.ToUpper() != "ALL")
{
this.GetSegments();
this.GetDownLoadDscriptions();
}
else
{
this.ddlSegments.ClearSelection();
this.ddDwnlDscrp.ClearSelection();
}
}

protected void DoExport(string Campaign)
{
try
{
if (this.GridView1.Visible)
{
this.lblStatus.Text = "";
string str = string.Empty;
str = ConfigurationManager.AppSettings["ContentType"];
if (string.IsNullOrEmpty(str))
{
str = "application/vnd.ms-excel";
}
string str2 = string.Empty;
str2 = ConfigurationManager.AppSettings["CharSet"];
if (string.IsNullOrEmpty(str2))
{
str2 = "UTF-8";
}
string str3 = string.Empty;
str3 = ConfigurationManager.AppSettings["FileName"];
if (string.IsNullOrEmpty(str3))
{
str3 = "NRTW_STATS";
}
DateTime startDateTime = this.GetStartDateTime();
string format = ConfigurationManager.AppSettings["DateFormat"];
string str5 = startDateTime.ToString(format);
XLWorkbook workbook = new XLWorkbook
{
Author = "OSCC-Campaign Director"
};
DataTable dataTable = this.GetDataTable(this.gvSummary, this.gvColumnNamesSummary);
workbook.Worksheets.Add(dataTable, "Summary");
DataTable table2 = this.GetDataTable(this.GridView1, this.gvColumnNames);
workbook.Worksheets.Add(table2, "Stats");
DateTime? start = null;
DataTable table3 = this.GetDataTableParams(start, null, Campaign);
workbook.Worksheets.Add(table3, "Parameters");
HttpResponse response = base.Response;
response.Clear();
response.ContentType = str;
response.AddHeader("content-disposition", "attachment; filename=" + str3 + "_" + str5 + ".xlsx");
using (MemoryStream stream = new MemoryStream())
{
workbook.SaveAs(stream);
stream.WriteTo(response.OutputStream);
stream.Close();
}
response.End();
}
}
catch (ThreadAbortException)
{
}
catch (Exception exception)
{
this.m_Error = exception.Message;
this.m_Error = this.m_Error + exception.StackTrace;
this.m_Error = this.m_Error.Replace(@"\", @"\\");
this.m_Error = this.m_Error.Replace("'", @"\'");
this.m_Error = Regex.Replace(this.m_Error, @"\s+", " ").Trim();
this.m_Error = base.Server.HtmlEncode(this.m_Error);
}
}

protected void GetSegments()
{
string str = base.Request.QueryString["OB"];
string str2 = base.Request.QueryString["Alias"];
string cObAlias = "";
if (string.IsNullOrEmpty(str))
{
str = ConfigurationManager.AppSettings["ObjectBroker"];
}
OleDbConnection connection = new OleDbConnection(AmAccess.GetObConnectionString(str, ref cObAlias));
connection.Open();
OleDbCommand selectCommand = new OleDbCommand("clients.dbo.spx_CampaignSegments", connection)
{
CommandType = CommandType.StoredProcedure,
CommandTimeout = connection.ConnectionTimeout
};
selectCommand.Parameters.AddWithValue("@campaignId", this.ddlCampaigns.SelectedItem.Value);
selectCommand.Parameters.AddWithValue("@segment", ConfigurationManager.AppSettings["SegmentField"]);
OleDbDataAdapter adapter = new OleDbDataAdapter(selectCommand);
DataSet dataSet = new DataSet();
adapter.Fill(dataSet);
this.ddlSegments.DataSource = dataSet.Tables[0];
this.ddlSegments.DataValueField = "STATE";
this.ddlSegments.DataTextField = "STATE";
this.ddlSegments.DataBind();
if (this.CheckConfigurationOn("AllowAllSegments"))
{
ListItem item = new ListItem("All", "All");
this.ddlSegments.Items.Insert(0, item);
item = new ListItem("None", "_x_none_x_");
this.ddlSegments.Items.Insert(0, item);
}
selectCommand.Dispose();
selectCommand = null;
dataSet.Dispose();
dataSet = null;
connection.Close();
}

This is the stored procedure. it is huge but I am included in case you want to take a look at it

USE [Clients]
GO
/****** Object: StoredProcedure [dbo].[spx_AmountStatsReport] Script Date: 10/9/2015 1:19:39 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO


/*
declare
@start datetime,
@end datetime,
@campaignId uniqueidentifier,
@campaignName varchar(250),
@segment varchar(50)

set @start = '2015-04-01'
set @end = '2015-06-01'
set @campaignId = '7692C909-076A-40D0-9E7C-2F7F84C6DF15'
--set @segment = 'P51'

exec clients.dbo.[spx_AmountStatsReport] @start, @end, @campaignId, @campaignName, null

exec clients.dbo.[spx_AmountStatsReport] @start, @end, @campaignId, @campaignName, @segment

*/

ALTER PROCEDURE [dbo].[spx_AmountStatsReport]
@start datetime = null,
@end datetime = null,
@campaignId uniqueidentifier = null,
@campaignName varchar(250) = null,
@segment varchar(50) = null
as
set nocount on

if @start is null begin
set @start = getdate()
set @start = convert( datetime, convert(varchar, @start, 110 ) ) --remove time portion
end

if @end is null or @end < @start begin
set @end = @start + 1
end

create table #camps
(
Seq int identity(1,1),
Id uniqueidentifier,
Name varchar(50)
)

if @campaignId is null and @campaignName is null begin
insert #camps
exec asdm.dbo.[sp_GetActiveCampaignsInPrd] @start, @end
end else if @campaignId is not null begin
insert #camps
select Id, Name from asdm.dbo.campaigns c with (nolock) where c.id = @campaignId
end else begin
insert #camps
select Id, Name from asdm.dbo.campaigns c with (nolock) where c.Name = @campaignName
end

create table #segments
(
Seq int identity(1,1),
Segment varchar(50)
)

if @segment != '_X_NONE_X_' begin
if @segment = 'All' begin
insert #segments
exec clients.dbo.spx_CampaignSegments @campaignId, 'SEG'
end else begin
insert #segments
select @segment
end
end else begin
set @segment = null
end

create table #hours
(
Campaign varchar(250) null,
Segment varchar(50) null,
Agent varchar(50) null,
CallSubType varchar(5) null,
Calls int null,
Contacts int null,
HoursFloat float null,
CPH float null,
[Hours] datetime null
)

create table #sales
(
Campaign varchar(250) null,
Segment varchar(50) null,
Agent varchar(50) null,
Verified varchar(50) null,
[Pledges] int null,
[Amount] money null
)

create table #hours2
(
Campaign varchar(250) null,
Segment varchar(50) null,
CallSubType varchar(5) null,
Calls int null,
Contacts int null,
HoursFloat float null,
CPH float null,
[Hours] datetime null
)

create table #sales2
(
Campaign varchar(250) null,
Segment varchar(50) null,
Verified varchar(50) null,
[Pledges] int null,
[Amount] money null
)

if @segment is null begin

insert #hours2
( Campaign, CallSubType, Calls, Contacts, HoursFloat, CPH, [Hours] )
select
[Campaign] = case when grouping(c.Name)=1 then 'Total' else c.Name end,
[CallSubType] = case when grouping(case when cell.CallSubType = 'T' then 'Y' else 'N' end)=1 then 'Total' else case when cell.CallSubType = 'T' then 'Y' else 'N' end end,
[Calls] = sum( coalesce(counts.Calls,0) ),
[Contacts] = sum( coalesce(results.CO,0) ),
[HoursFloat] = sum(coalesce(times.Handle,0) + coalesce(times.Wait,0) + coalesce(solt.Initial,0) + coalesce(solt.FinalWait,0) ) * 24.,
[CPH] = case when sum( coalesce(results.CO,0) ) = 0 then 0 else
sum(results.CO) /
sum( coalesce(times.Handle,0) + coalesce(times.Wait,0) + coalesce(solt.Initial,0) + coalesce(solt.FinalWait,0) ) / 24.
end,
[Hours] = convert(datetime, sum(coalesce(times.Handle,0) + coalesce(times.Wait,0) + coalesce(solt.Initial,0) + coalesce(solt.FinalWait,0) ) )
from asdm.dbo.statCell cell with (nolock)
left join asdm.dbo.statCounts counts with (nolock)
on cell.Id = counts.CellId
left join asdm.dbo.StatResults results with (nolock)
on cell.Id = results.CellId
left join asdm.dbo.statTimes times with (nolock)
on cell.Id = times.CellId
left join asdm.dbo.StatOfflineTimes solt with (nolock)
on cell.Id = solt.CellId
left join #camps c with (nolock)
on cell.campaignId = c.Id
where cell.start >= @start and cell.start < @end
and cell.CampaignId in ( select Id from #camps )
and c.Name is not null and cell.AgentId != ''
group by c.Name, case when cell.CallSubType = 'T' then 'Y' else 'N' end
with rollup
order by grouping(c.Name), c.Name

insert #sales2
( Campaign, Verified, Pledges, Amount )
select
[Campaign] = case when grouping(c.Name)=1 then 'Total' else c.Name end,
[Verified] = case when grouping(case when a.CallSubType = 'T' then 'Y' else 'N' end)=1 then 'Total' else case when a.CallSubType = 'T' then 'Y' else 'N' end end,
[Pledges] = sum( case when 1 = 1 then 1 else 0 end ),
[Amount] = sum(coalesce(a.Amount,0))
from clients.dbo.AmountStats a with (nolock)
inner join #camps c with (nolock)
on a.campaignId = c.ID
where a.Start >= @start and a.Start < @end
and a.campaignId in ( select Id from #camps )
group by c.Name, case when a.CallSubType = 'T' then 'Y' else 'N' end
with rollup
order by grouping(c.Name), c.Name--, grouping(a.CallSubType), a.CallSubType

insert #hours
( Campaign, Agent, CallSubType, Calls, Contacts, HoursFloat, CPH, [Hours] )
select
[Campaign] = case when grouping(c.Name)=1 then 'Total' else c.Name end,
[Agent] = case when grouping(cell.AgentId)=1 then 'Total' else cell.AgentId end,
[CallSubType] = case when grouping(cell.CallSubType)=1 then 'Total' else case when cell.CallSubType = 'T' then 'Y' else 'N' end end,
[Calls] = sum( coalesce(counts.Calls,0) ),
[Contacts] = sum( coalesce(results.CO,0) ),
[HoursFloat] = sum(coalesce(times.Handle,0) + coalesce(times.Wait,0) + coalesce(solt.Initial,0) + coalesce(solt.FinalWait,0) ) * 24.,
[CPH] = case when sum( coalesce(results.CO,0) ) = 0 then 0 else
sum(results.CO)
/
sum( coalesce(times.Handle,0) + coalesce(times.Wait,0) + coalesce(solt.Initial,0) + coalesce(solt.FinalWait,0) ) / 24.
end,
[Hours] = convert(datetime, sum(coalesce(times.Handle,0) + coalesce(times.Wait,0) + coalesce(solt.Initial,0) + coalesce(solt.FinalWait,0) ) )
from asdm.dbo.statCell cell with (nolock)
left join asdm.dbo.statCounts counts with (nolock)
on cell.Id = counts.CellId
left join asdm.dbo.StatResults results with (nolock)
on cell.Id = results.CellId
left join asdm.dbo.statTimes times with (nolock)
on cell.Id = times.CellId
left join asdm.dbo.StatOfflineTimes solt with (nolock)
on cell.Id = solt.CellId
left join #camps c with (nolock)
on cell.campaignId = c.Id
where cell.start >= @start and cell.start < @end
and cell.CampaignId in ( select Id from #camps )
and c.Name is not null and cell.AgentId != ''
group by c.Name, cell.AgentId, cell.CallSubType
with rollup
order by grouping(c.Name), c.Name, grouping(cell.AgentId), cell.AgentId, grouping(cell.CallSubType), cell.CallSubType

insert #sales
( Campaign, Agent, Verified, Pledges, Amount )
select
[Campaign] = case when grouping(c.Name)=1 then 'Total' else c.Name end,
[Agent] = case when grouping(a.agentId)=1 then 'Total' else a.AgentId end,
[Verified] = case when grouping(a.CallSubType)=1 then 'Total' else case when a.CallSubType = 'T' then 'Y' else 'N' end end,
[Pledges] = sum( case when 1 = 1 then 1 else 0 end ),
[Amount] = sum(coalesce(a.Amount,0))
from clients.dbo.AmountStats a with (nolock)
inner join #camps c with (nolock)
on a.campaignId = c.ID
where a.Start >= @start and a.Start < @end
and a.campaignId in ( select Id from #camps )
group by c.Name, a.agentId, a.CallSubType
with rollup
order by grouping(c.Name), c.Name, grouping(a.agentId), a.agentId, grouping(a.CallSubType), a.CallSubType

--SUMMARY SECTION
select
[Campaign] = s.Campaign,
[Verified] = s.Verified,
[Calls] = h.Calls,
[Contacts] = h.Contacts,
[Pledges] = s.Pledges,
[Hours] = asdm.dbo.[FormatD2DetailHours](h.[Hours]),
[CPH] = round(h.CPH,2),
[PPH] = case when h.HoursFloat = 0 then 0 else
round(s.Pledges / h.HoursFloat,2) end,
[PledgeRate] = case when h.Contacts = 0 then 0 else
round((convert(float,s.Pledges) / convert(float,h.Contacts))*100.,2) end,
[Amount] = s.Amount,
[PledgeAverage] = case when s.Pledges = 0 then 0 else
round(s.Amount / s.Pledges,2) end,
[HourlyAverage] = case when h.HoursFloat = 0 then 0 else
round(s.Amount / h.HoursFloat,2) end
from #sales2 as s with (nolock)
inner join #hours2 as h with (nolock)
on s.Campaign = h.Campaign and s.Verified = h.CallSubType

--REPORT SECTION
select
[Campaign] = s.Campaign,
[Agent] = s.Agent,
[Verified] = s.Verified,
[Calls] = h.Calls,
[Contacts] = h.Contacts,
[Pledges] = s.Pledges,
[Hours] = asdm.dbo.[FormatD2DetailHours](h.[Hours]),
[CPH] = round(h.CPH,2),
[PPH] = case when h.HoursFloat = 0 then 0 else
round(s.Pledges / h.HoursFloat,2) end,
[PledgeRate] = case when h.Contacts = 0 then 0 else
round((convert(float,s.Pledges) / convert(float,h.Contacts))*100.,2) end,
[Amount] = s.Amount,
[PledgeAverage] = case when s.Pledges = 0 then 0 else
round(s.Amount / s.Pledges,2) end,
[HourlyAverage] = case when h.HoursFloat = 0 then 0 else
round(s.Amount / h.HoursFloat,2) end
from #sales as s with (nolock)
inner join #hours as h with (nolock)
on s.Campaign = h.Campaign and s.Agent = h.Agent and s.Verified = h.CallSubType

end else begin

insert #hours2
( Campaign, Segment, CallSubType, Calls, Contacts, HoursFloat, CPH, [Hours] )
select
[Campaign] = case when grouping(c.Name)=1 then 'Total' else c.Name end,
[Segment] = case when grouping(cell.CustomField)=1 then 'Total' else cell.CustomField end,
[CallSubType] = case when grouping(case when cell.CallSubType = 'T' then 'Y' else 'N' end)=1 then 'Total' else case when cell.CallSubType = 'T' then 'Y' else 'N' end end,
[Calls] = sum( coalesce(counts.Calls,0) ),
[Contacts] = sum( coalesce(results.CO,0) ),
[HoursFloat] = sum(coalesce(times.Handle,0) + coalesce(times.Wait,0) + coalesce(solt.Initial,0) + coalesce(solt.FinalWait,0) ) * 24.,
[CPH] = case when sum( coalesce(results.CO,0) ) = 0 then 0 else
sum(results.CO) /
sum( coalesce(times.Handle,0) + coalesce(times.Wait,0) + coalesce(solt.Initial,0) + coalesce(solt.FinalWait,0) ) / 24.
end,
[Hours] = convert(datetime, sum(coalesce(times.Handle,0) + coalesce(times.Wait,0) + coalesce(solt.Initial,0) + coalesce(solt.FinalWait,0) ) )
from asdm.dbo.statCell cell with (nolock)
left join asdm.dbo.statCounts counts with (nolock)
on cell.Id = counts.CellId
left join asdm.dbo.StatResults results with (nolock)
on cell.Id = results.CellId
left join asdm.dbo.statTimes times with (nolock)
on cell.Id = times.CellId
left join asdm.dbo.StatOfflineTimes solt with (nolock)
on cell.Id = solt.CellId
left join #camps c with (nolock)
on cell.campaignId = c.Id
where cell.start >= @start and cell.start < @end
and cell.CampaignId in ( select Id from #camps )
and cell.CustomField in ( select Segment from #segments )
and c.Name is not null and cell.AgentId != ''
group by c.Name, cell.CustomField, case when cell.CallSubType = 'T' then 'Y' else 'N' end
with rollup
order by grouping(c.Name), c.Name, grouping(cell.CustomField), cell.CustomField

insert #sales2
( Campaign, Segment, Verified, Pledges, Amount )
select
[Campaign] = case when grouping(c.Name)=1 then 'Total' else c.Name end,
[Segment] = case when grouping(a.Segment)=1 then 'Total' else a.Segment end,
[Verified] = case when grouping(case when a.CallSubType = 'T' then 'Y' else 'N' end)=1 then 'Total' else case when a.CallSubType = 'T' then 'Y' else 'N' end end,
[Pledges] = sum( case when 1 = 1 then 1 else 0 end ),
[Amount] = sum(coalesce(a.Amount,0))
from clients.dbo.AmountStats a with (nolock)
inner join #camps c with (nolock)
on a.campaignId = c.ID
where a.Start >= @start and a.Start < @end
and a.campaignId in ( select Id from #camps )
group by c.Name, a.Segment, case when a.CallSubType = 'T' then 'Y' else 'N' end
with rollup
order by grouping(c.Name), c.Name--, grouping(a.CallSubType), a.CallSubType

insert #hours
select
[Campaign] = case when grouping(c.Name)=1 then 'Total' else c.Name end,
[Segment] = case when grouping(cell.CustomField)=1 then 'Total' else cell.CustomField end,
[Agent] = case when grouping(cell.AgentId)=1 then 'Total' else cell.AgentId end,
[CallSubType] = case when grouping(cell.CallSubType)=1 then 'Total' else case when cell.CallSubType = 'T' then 'Y' else 'N' end end,
[Calls] = sum( coalesce(counts.Calls,0) ),
[Contacts] = sum( coalesce(results.CO,0) ),
[HoursFloat] = sum(coalesce(times.Handle,0) + coalesce(times.Wait,0) + coalesce(solt.Initial,0) + coalesce(solt.FinalWait,0) ) * 24.,
[CPH] = case when sum( coalesce(results.CO,0) ) = 0 then 0 else
sum(results.CO) /
sum( coalesce(times.Handle,0) + coalesce(times.Wait,0) + coalesce(solt.Initial,0) + coalesce(solt.FinalWait,0) ) / 24.
end,
[Hours] = convert(datetime, sum(coalesce(times.Handle,0) + coalesce(times.Wait,0) + coalesce(solt.Initial,0) + coalesce(solt.FinalWait,0) ) )
from asdm.dbo.statCell cell with (nolock)
left join asdm.dbo.statCounts counts with (nolock)
on cell.Id = counts.CellId
left join asdm.dbo.StatResults results with (nolock)
on cell.Id = results.CellId
left join asdm.dbo.statTimes times with (nolock)
on cell.Id = times.CellId
left join asdm.dbo.StatOfflineTimes solt with (nolock)
on cell.Id = solt.CellId
left join #camps c with (nolock)
on cell.campaignId = c.Id
where cell.start >= @start and cell.start < @end
and cell.CustomField in ( select Segment from #segments )
and cell.CampaignId in ( select Id from #camps )
and c.Name is not null and cell.AgentId != ''
group by c.Name, cell.CustomField, cell.AgentId, cell.CallSubType
with rollup
order by grouping(c.Name), c.Name, grouping(cell.CustomField), cell.CustomField, grouping(cell.AgentId), cell.AgentId, grouping(cell.CallSubType), cell.CallSubType

insert #sales
select
[Campaign] = case when grouping(c.Name)=1 then 'Total' else c.Name end,
[Segment] = case when grouping(a.Segment)=1 then 'Total' else a.Segment end,
[Agent] = case when grouping(a.agentId)=1 then 'Total' else a.AgentId end,
[Verified] = case when grouping(a.CallSubType)=1 then 'Total' else case when a.CallSubType = 'T' then 'Y' else 'N' end end,
[Pledges] = sum( case when 1 = 1 then 1 else 0 end ),
[Amount] = sum(coalesce(a.Amount,0))
from clients.dbo.AmountStats a with (nolock)
inner join #camps c with (nolock)
on a.campaignId = c.ID
where a.Start >= @start and a.Start < @end
and a.Segment in ( select Segment from #segments )
and a.campaignId in ( select Id from #camps )
group by c.Name, a.Segment, a.agentId, a.CallSubType
with rollup
order by grouping(c.Name), c.Name, grouping(a.Segment), a.Segment, grouping(a.agentId), a.agentId, grouping(a.CallSubType), a.CallSubType

--SUMMARY SECTION
select
[Campaign] = s.Campaign,
[Segment] = s.Segment,
[Verified] = s.Verified,
[Calls] = h.Calls,
[Contacts] = h.Contacts,
[Pledges] = s.Pledges,
[Hours] = asdm.dbo.[FormatD2DetailHours](h.[Hours]),
[CPH] = round(h.CPH,2),
[PPH] = case when h.HoursFloat = 0 then 0 else
round(s.Pledges / h.HoursFloat,2) end,
[PledgeRate] = case when h.Contacts = 0 then 0 else
round((convert(float,s.Pledges) / convert(float,h.Contacts))*100.,2) end,
[Amount] = s.Amount,
[PledgeAverage] = case when s.Pledges = 0 then 0 else
round(s.Amount / s.Pledges,2) end,
[HourlyAverage] = case when h.HoursFloat = 0 then 0 else
round(s.Amount / h.HoursFloat,2) end
from #sales2 as s with (nolock)
inner join #hours2 as h with (nolock)
on s.Campaign = h.Campaign and s.Segment = h.Segment and s.Verified = h.CallSubType


--REPORT SECTION
select
[Campaign] = s.Campaign,
[Segment] = s.Segment,
[Agent] = s.Agent,
[Verified] = s.Verified,
[Calls] = h.Calls,
[Contacts] = h.Contacts,
[Pledges] = s.Pledges,
[Hours] = asdm.dbo.[FormatD2DetailHours](h.[Hours]),
[CPH] = round(h.CPH,2),

[PPH] = case when h.HoursFloat = 0 then 0 else
round(s.Pledges / h.HoursFloat,2)
end,
[PledgeRate] = case when h.Contacts = 0 then 0 else
round((convert(float,s.Pledges) / convert(float,h.Contacts))*100.,2)
end,
[Amount] = s.Amount,
[PledgeAverage] = case when s.Pledges = 0 then 0 else
round(s.Amount / s.Pledges,2)
end,
[HourlyAverage] = case when h.HoursFloat = 0 then 0 else
round(s.Amount / h.HoursFloat,2)
end
from #sales as s with (nolock)
inner join #hours as h with (nolock)
on s.Campaign = h.Campaign and s.Segment = h.Segment and s.Agent = h.Agent and s.Verified = h.CallSubType
end

--debug

--select * from #hours
--select * from #sales

drop table #camps
drop table #hours
drop table #sales
drop table #hours2
drop table #sales2
drop table #segments

I am really stuck at how to change single to multiple selection and made this changes to stored procedure. I really value your help.


Viewing all articles
Browse latest Browse all 20

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>