Showing posts with label generate. Show all posts
Showing posts with label generate. Show all posts

Thursday, March 22, 2012

custom web app for reportviewer

Hi,

I am trying to develop a custom web page to display and generate our company reports.

It shoud have a login page, and then a general window with 2 or 3 frames (top frame with general info, left frame with a

dynamic list of all existing reports (eventually categorized by a certain word in the report title), and a center frame

that has initialy the company logo and after selecting a specific report displays the parameters and afterwards the

generated report).

Does anybody has some pointers or links on the web where some of this is a little bit documented.

I have dev skills in vb.net and know how to work with ssrs.

My web dev skills are intermediate.

All info, tips, hints are very welcome ...

Greetings

Vinnie

If ou want logic i can provide you that..

code you need to write..

I think you can create login page and list of report..

For the 3rd frame.

keep 3 control there

1 image

2 panel with all the controls thath you need for parameter

3 reportviewer control (property visible = false and size (min that you want)

for 1 - you can initially keep image visible.

on click on list of report make it invicible and make the panel for parameter visible.

2) initially invisible as i said above while keeping it visible check for the parameters for the report that are needed and make thaem visible. everything else invisible.

( In my 10 reports I have kept name of the parameters same for same type like if i need to pull patientname and first visit date ..... so my report parameter is patienName, StartDate in 2 nd report date is i need Patientname with last visitdte

then parameter would be PatientName,last date.

in 3rd report i need patient visited between FirstDate and lastDate.. I would keep same parameter Name..

So for each parameter I hav one control.

So it would be easy to make them visible as per report name.

After that you need to set report to report viewer

than pass parameter values to report

than database login to report( if needed)

than make report viewer visible.

RptViewer.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Local;

string ReportPath = "";

ReportPath = ReportLoad.Reportpath + ReportRow["ReportName"].ToString();// ;

if (File.Exists(ReportPath))

{

RptViewer.LocalReport.ReportPath = ReportPath;

//RptViewer.SetDisplayMode(Microsoft.Reporting.WinForms.DisplayMode.PrintLayout);

//RptViewer.ZoomMode = Microsoft.Reporting.WinForms.ZoomMode.Percent;

//RptViewer.ZoomPercent = 100;

RptViewer.LocalReport.DataSources.Clear();

SetReportParameter(weekdate);

RptViewer.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("SlimPOS", GetWeekenderData(weekdate)));

RptViewer.RefreshReport();

}

private void SetReportParameter(DateTime weekenddate)

{

Microsoft.Reporting.WinForms.ReportParameterInfoCollection ParInfo;

Microsoft.Reporting.WinForms.ReportParameter[] RepParameter;

ParInfo = RptViewer.LocalReport.GetParameters();

RepParameter = new Microsoft.Reporting.WinForms.ReportParameter[ParInfo.Count];

for (int j = 0; j < ParInfo.Count; j++)

{

switch (ParInfo[j].Name.ToLower())

{

case "centername":

RepParameter[j] = new Microsoft.Reporting.WinForms.ReportParameter("CenterName", domain.Name.ToString(), false);

break;

case "pweekstartdate":

RepParameter[j] = new Microsoft.Reporting.WinForms.ReportParameter("StartDate", Settings.GetStartOfWeek(weekenddate).ToShortDateString());

break;

case "pweekenddate":

RepParameter[j] = new Microsoft.Reporting.WinForms.ReportParameter("EndDate", Settings.GetEndOfWeek(weekenddate).ToShortDateString());

break;

}

}

RptViewer.LocalReport.SetParameters(RepParameter);

}

private void SetDBLogonForReport(string ReportTitle)

{

Microsoft.Reporting.WinForms.DataSourceCredentials[] crd = new Microsoft.Reporting.WebForms.DataSourceCredentials[1];

crd[0] = new Microsoft.Reporting.WinForms.DataSourceCredentials();

crd[0].Name = ReportTitle;

crd[0].UserId = User;

crd[0].Password = Pwd;

RptViewer.LocalReport.SetDataSourceCredentials(crd);

}

Hope it helps.. all the best..

|||

If ou want logic i can provide you that..

code you need to write..

I think you can create login page and list of report..

For the 3rd frame.

keep 3 control there

1 image

2 panel with all the controls thath you need for parameter

3 reportviewer control (property visible = false and size (min that you want)

for 1 - you can initially keep image visible.

on click on list of report make it invicible and make the panel for parameter visible.

2) initially invisible as i said above while keeping it visible check for the parameters for the report that are needed and make thaem visible. everything else invisible.

( In my 10 reports I have kept name of the parameters same for same type like if i need to pull patientname and first visit date ..... so my report parameter is patienName, StartDate in 2 nd report date is i need Patientname with last visitdte

then parameter would be PatientName,last date.

in 3rd report i need patient visited between FirstDate and lastDate.. I would keep same parameter Name..

So for each parameter I hav one control.

So it would be easy to make them visible as per report name.

After that you need to set report to report viewer

than pass parameter values to report

than database login to report( if needed)

than make report viewer visible.

RptViewer.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Local;

string ReportPath = "";

ReportPath = ReportLoad.Reportpath + ReportRow["ReportName"].ToString();// ConfigurationManager.AppSettings.GetValues("RSReportpath")[0].ToString() + ReportName; // @."c:\code\slimcommon\reporting service reports\rs report\" + ReportTitle + ".rdl";// Application.StartupPath;

if (File.Exists(ReportPath))

{

RptViewer.LocalReport.ReportPath = ReportPath;

//RptViewer.SetDisplayMode(Microsoft.Reporting.WinForms.DisplayMode.PrintLayout);

//RptViewer.ZoomMode = Microsoft.Reporting.WinForms.ZoomMode.Percent;

//RptViewer.ZoomPercent = 100;

RptViewer.LocalReport.DataSources.Clear();

SetReportParameter(weekdate);

RptViewer.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("SlimPOS", GetWeekenderData(weekdate)));

RptViewer.RefreshReport();

}

private void SetReportParameter(DateTime weekenddate)

{

Microsoft.Reporting.WinForms.ReportParameterInfoCollection ParInfo;

Microsoft.Reporting.WinForms.ReportParameter[] RepParameter;

ParInfo = RptViewer.LocalReport.GetParameters();

RepParameter = new Microsoft.Reporting.WinForms.ReportParameter[ParInfo.Count];

for (int j = 0; j < ParInfo.Count; j++)

{

switch (ParInfo[j].Name.ToLower())

{

case "centername":

RepParameter[j] = new Microsoft.Reporting.WinForms.ReportParameter("CenterName", domain.Name.ToString(), false);

break;

case "pweekstartdate":

RepParameter[j] = new Microsoft.Reporting.WinForms.ReportParameter("StartDate", Settings.GetStartOfWeek(weekenddate).ToShortDateString());

break;

case "pweekenddate":

RepParameter[j] = new Microsoft.Reporting.WinForms.ReportParameter("EndDate", Settings.GetEndOfWeek(weekenddate).ToShortDateString());

break;

}

}

RptViewer.LocalReport.SetParameters(RepParameter);

}

private void SetDBLogonForReport(string ReportTitle)

{

Microsoft.Reporting.WinForms.DataSourceCredentials[] crd = new Microsoft.Reporting.WebForms.DataSourceCredentials[1];

crd[0] = new Microsoft.Reporting.WinForms.DataSourceCredentials();

crd[0].Name = ReportTitle;

crd[0].UserId = User;

crd[0].Password = Pwd;

RptViewer.LocalReport.SetDataSourceCredentials(crd);

}

Hope it helps.. all the best..

sql

Sunday, March 11, 2012

Custom Properties and PDF Properties

We need to generate PDF files as our end point. These files must contain
'custom properties' (such as Author, Title, 'What Have You') which will be
used to index the documents for searches. We will generate our reports
using Reporting Services and then 'export' them to PDF format. We are not
sure that
Reporting Services "CustomProperties" will work to achive this goal. We
also have seen no working code examples of "CustomProperties". Do anyone
have anything to contribute to these questions? Thanks in advance. dlrHello Dennis,
Based on my scope, "CustomProperties" of pdf is not supported for pdf
rendering extention. Customproperties settings in SRS are used when
processing custom report item control. You may want to click "send
feedback" toolbar in SQL 2005 BOL to send your feedback on this to product
team.
Best Regards,
Peter Yang
MCSE2000/2003, MCSA, MCDBA
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=====================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
>From: "D Redfield" <dennis_redfield@.newsgroup.nospam>
>Subject: Custom Properties and PDF Properties
>Date: Tue, 7 Feb 2006 16:13:25 -0500
>Lines: 10
>X-Priority: 3
>X-MSMail-Priority: Normal
>X-Newsreader: Microsoft Outlook Express 6.00.2800.1506
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506
>Message-ID: <#LAdWtCLGHA.3496@.TK2MSFTNGP14.phx.gbl>
>Newsgroups: microsoft.public.sqlserver.reportingsvcs
>NNTP-Posting-Host: rrcs-24-39-49-178.nys.biz.rr.com 24.39.49.178
>Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP14.phx.gbl
>Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.sqlserver.reportingsvcs:68257
>X-Tomcat-NG: microsoft.public.sqlserver.reportingsvcs
>We need to generate PDF files as our end point. These files must contain
>'custom properties' (such as Author, Title, 'What Have You') which will be
>used to index the documents for searches. We will generate our reports
>using Reporting Services and then 'export' them to PDF format. We are not
>sure that
>Reporting Services "CustomProperties" will work to achive this goal. We
>also have seen no working code examples of "CustomProperties". Do anyone
>have anything to contribute to these questions? Thanks in advance. dlr
>
>

Custom Primary Key

Not sure where to post this as it may be a form operation but here goes...

I want to generate a custom unique identifier for a table similar to the Northwind Customers database (ie ALFKI, ANTON, etc...) which can be used as a descriptive identifier as well.

For example, I have a Products table and I want to have my keys look like: CHR-0001-05.

"CHR" is my abbreviation for Chairs
"0001" is the auto-incrementing number (in this case the first record of the table)
"05" is the last 2 digits of the year recieved (2005)

Can somebody please point me in the right direction? I'm having problems finding resources on the web relating to this topic (prolly not using the correct keywords for my searches)

Cheers =)

You can use '+' operator to concatinate strings, here is a sample script:

if object_id('tbl_GPK','U') is not null
drop table tbl_GPK
go
Create table tbl_GPK (EName varchar(50),EDate smalldatetime)
go
insert into tbl_GPK select 'Peacock Margaret',GetDate()

if object_id('UDF_Gen_PK','FN') is not null
drop function UDF_Gen_PK
go
create function UDF_Gen_PK (@.S varchar(50))
returns varchar(60)
as
begin
declare @.outstring varchar(60)
declare @.i int
select @.i=1,@.outstring=''
while (@.i<=len(@.S))
begin
select @.outstring=@.outstring+substring(@.S,@.i,1)
set @.i=@.i+5
end
select @.outstring=@.outstring+'-'+convert(varchar(10),count(*)+1)
from tbl_GPK
return @.outstring
end

go
alter table tbl_GPK
add PK as (dbo.UDF_Gen_PK(EName)+'-'+convert(varchar(4),Year(EDate)))
go

select * from tbl_GPK