Showing posts with label page. Show all posts
Showing posts with label page. Show all posts

Monday, March 26, 2012

Refreshing

I have report that has a grouping with a +/- for one of the groups to expand. Everytime I expand or collapse the group it seems the page refreshes and resizes. Is there a way to open an close without posting back or at least giving the appearance that the form posts back?

Thanks,

Hi Raj,

I have the same question as yours. Can you tell me your current way to work on +/- by posting back?

Many thanks,
cukhoai|||

I am not Raj, so I am not sure who you are referring to.

Right now I just group one of the items and allow another field to control the toggling. I am still looking for a way to eliminate the refresh or make it so there is no resizing.

Refresh with jsp doesnt work

Hi!

I've created a simple jsp page with a crystal report viewer on it. I used Crystal Reports Developer to design the report, as db I use access and IBM WSED to create and run the jsp file on a server. That works fine, but when I would refresh the report it shows no recordset (and also no error message appears). Why I can't refresh the data?

The code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@. page import="com.crystaldecisions.report.web.viewer.CrystalReportViewer" %>
<%@. page import="com.crystaldecisions.sdk.occa.report.data.*" %>
<%@. page import="com.crystaldecisions.reports.reportengineinterface.JPEReportSourceFactory,
com.crystaldecisions.sdk.occa.report.reportsource.IReportSourceFactory2,com.crystaldecisions.sdk.occa.report.reportsource.IReportSource"
%>
<HTML>
<HEAD>
</HEAD>
<BODY>
CrystalTest.jsp

<%
try {

IReportSourceFactory2 rptSrcFactory = new JPEReportSourceFactory();

String report = "/CrystalReport/Report1.rpt";

Object reportSource = rptSrcFactory.createReportSource(report, request.getLocale())

CrystalReportViewer viewer = new CrystalReportViewer();
viewer.setReportSource(reportSource);

viewer.setOwnPage(true);
viewer.setTop(80);
viewer.setDisplayGroupTree(false);
viewer.setHasLogo(false);
viewer.setHasRefreshButton(true);

viewer.processHttpRequest(request, response, getServletConfig().getServletContext(), null);
viewer.dispose();
} catch(Exception e)
{

out.println("CrystalTest: "+e);
}
%>

</BODY
</HTML>hi there!

I've now solved the problem with a jdbc/db2 connection.

The solution is, that I must connect the Crystal Report with jdbc/db2 to the database and also connect in java/jsp to the database as the follows (only samplecode from helpfile):

setDbLogonViewReport.jsp

<%@. page import= "com.crystaldecisions.report.web.viewer.*,
com.crystaldecisions.sdk.occa.report.data.*" %>
<%@. page import="com.crystaldecisions.report.web.viewer.*" %>
<%@. page import="com.crystaldecisions.sdk.occa.report.data.*" %>
<%@. page import="com.crystaldecisions.reports.reportengineinterface.JPEReportSourceFactory" %>
<%@. page import="com.crystaldecisions.sdk.occa.report.reportsource.IReportSourceFactory2" %>

<%
Object reportSource = session.getAttribute("reportSource");
if (reportSource == null)
{
String report = "/reports/sample.rpt";
IReportSourceFactory2 rptSrcFactory = new JPEReportSourceFactory();
reportSource = rptSrcFactory.createReportSource(report, request.getLocale());
session.setAttribute("reportSource", reportSource);
}

ConnectionInfos connInfos = new ConnectionInfos();
IConnectionInfo connInfo1 = new ConnectionInfo();
connInfo1.setUserName("reportLogin");
connInfo1.setPassword("");
connInfos.add(connInfo1);

CrystalReportViewer viewer = new CrystalReportViewer();

viewer.setReportSource(reportSource);
&n bsp; viewer.setEnableLogonPrompt(false);
viewer.setDatabaseLogonInfos(connInfos);

if (session.getAttribute("refreshed") == null)
{
viewer.refresh();
session.setAttribute("refreshed", "true");
}

viewer.setOwnPage(true);

viewer.processHttpRequest(request, response, getServletConfig().getServletContext(), null);
%>

Ask if you've more questions to that.

Friday, March 23, 2012

Refresh page when database data is update

Hi All,

Is it possible to refresh the web page when certain table data is updated? And I cannot use the auto-refresh feature. Thank you very much.

Not easily. I imagine you could hobble something together with AJAX, but it would likely be fragile and not easy to maintain.

Tuesday, March 20, 2012

Referencing sql in IF THEN ELSE Statement

The Background:

From page 1 a search is created and this value is converted to a querystring and given the name "id=" and passed to page 2. Page 2 then does a lookup in the sql 2000 db useing this querystring.

<

asp:SqlDataSourceID="SqlDataSource1"runat="server"ConnectionString="<%$ ConnectionStrings:ListingDBConnectionString %>"SelectCommand="SELECT [ID], [CompName], [Package] FROM [CDetails] WHERE ([ID] = @.ID)"><SelectParameters><asp:QueryStringParameterName="ID"QueryStringField="id"Type="Int32"/></SelectParameters></asp:SqlDataSource>

The Problem:

What I then need to do is an IF THEN ELSE statement.

IF [Package in SQL1] = 4 Then

Package 4

IF [Package in SQL1] = 3 Then

Package 3

Only how do I reference the sql value in the if statement.

I have tried

<%IF Eval("Package") = 4 Then %> and with Bind - No good

Hi asiddle,

If you want to proceed IF then in SQL statement, I suggest you use CASE...WHEN...

You can first put the SelectCommand into a stored procedure, then use CASE...WHEN... to do the switch.

For more information, please check the following link:

http://msdn2.microsoft.com/en-us/library/ms181765.aspx

HTH. If this does not answer your question, please feel free to mark the post as Not Answered and reply. Thank you!

|||

Hello Kevin,

Many thanks for your reply. Unfortunately I cant make head nor tails of it. I followed your link to msdn but as usual all its actually done is confused the hell out of me. Is it possible you could drop an example?

Many thanks

|||

Hi asiddle,

I suggest you put the CASE...WHEN into a stored procedure, and take @.ID as parameter.

For example:

SELECT [ID], [CompName], [Package] FROM [CDetails] WHERE [ID] =
CASE
WHEN @.ID>1 Then XXXX
WHEN XXXX Then XXXX

|||

[Package] is an integer field ?

SELECT [ID], [CompName], 'Package ' + convert(varchar(10), [Package]) as [Package_Desc]

FROM [CDetails] WHERE ([ID] = @.ID

Referencing Parameters in Report Code

I'm trying to refer to a report parameter in my Code block from the Report
Properties page. But it keeps giving me an error that says, "Reference to a
non-shared member requires an object reference." I'm refering the parameter
as Parameters!pBusiness.Label.
Any ideas about how I can see my parameters within the Code block of the
Report itself?you must pass the values in ie
code.dosomething(Param1!value, Param2.value)
--
Wayne Snyder MCDBA, SQL Server MVP
Mariner, Charlotte, NC
(Please respond only to the newsgroup.)
I support the Professional Association for SQL Server ( PASS) and it's
community of SQL Professionals.
"SteveCole63" <SteveCole63@.discussions.microsoft.com> wrote in message
news:C23B3F0A-A341-47AD-A678-6A6DFD9EE114@.microsoft.com...
> I'm trying to refer to a report parameter in my Code block from the Report
> Properties page. But it keeps giving me an error that says, "Reference to
a
> non-shared member requires an object reference." I'm refering the
parameter
> as Parameters!pBusiness.Label.
> Any ideas about how I can see my parameters within the Code block of the
> Report itself?|||Actually Wayne, you can refer to parameters (I discovered after I posted) as
Report.Parameters!pBusiness.Label.
Thanks for the reply!
"Wayne Snyder" wrote:
> you must pass the values in ie
> code.dosomething(Param1!value, Param2.value)
> --
> Wayne Snyder MCDBA, SQL Server MVP
> Mariner, Charlotte, NC
> (Please respond only to the newsgroup.)
> I support the Professional Association for SQL Server ( PASS) and it's
> community of SQL Professionals.
> "SteveCole63" <SteveCole63@.discussions.microsoft.com> wrote in message
> news:C23B3F0A-A341-47AD-A678-6A6DFD9EE114@.microsoft.com...
> > I'm trying to refer to a report parameter in my Code block from the Report
> > Properties page. But it keeps giving me an error that says, "Reference to
> a
> > non-shared member requires an object reference." I'm refering the
> parameter
> > as Parameters!pBusiness.Label.
> >
> > Any ideas about how I can see my parameters within the Code block of the
> > Report itself?
>
>

Referencing a value on one page of a report in a textbox

Hello,
I am creating a profit and loss statement in SQL Server reporting Services.
This single report creates a one page P&L for each loction in the company.
Some of the calculations are based on the Sales of each location (i.e.
percentages etc.). I'd like to reference the sales total for the each
location in one of the groupings of the report. The problem is, when I do
"Sum(Sales)" it doesn't sum the sales figures for the location, but only the
grouping I'm in. Is there a way to do this expression so it sums the Sales
figure for the whole location? If not, is there a way to reference a
particular textbox on the report?
Any help or direction would be greatly appreciated.
Thanks!
RickHey Rico,
Try Using:
RunningValue(Fields!Sales.Value, Sum,"LocationGroupName")
Michael C
"Rico" wrote:
> Hello,
> I am creating a profit and loss statement in SQL Server reporting Services.
> This single report creates a one page P&L for each loction in the company.
> Some of the calculations are based on the Sales of each location (i.e.
> percentages etc.). I'd like to reference the sales total for the each
> location in one of the groupings of the report. The problem is, when I do
> "Sum(Sales)" it doesn't sum the sales figures for the location, but only the
> grouping I'm in. Is there a way to do this expression so it sums the Sales
> figure for the whole location? If not, is there a way to reference a
> particular textbox on the report?
> Any help or direction would be greatly appreciated.
> Thanks!
> Rick
>
>|||Thanks!
"Michael C" <MichaelC@.discussions.microsoft.com> wrote in message
news:1F8BB7D0-3298-4A46-BB9D-389C26386523@.microsoft.com...
> Hey Rico,
> Try Using:
> RunningValue(Fields!Sales.Value, Sum,"LocationGroupName")
> Michael C
> "Rico" wrote:
>> Hello,
>> I am creating a profit and loss statement in SQL Server reporting
>> Services.
>> This single report creates a one page P&L for each loction in the
>> company.
>> Some of the calculations are based on the Sales of each location (i.e.
>> percentages etc.). I'd like to reference the sales total for the each
>> location in one of the groupings of the report. The problem is, when I
>> do
>> "Sum(Sales)" it doesn't sum the sales figures for the location, but only
>> the
>> grouping I'm in. Is there a way to do this expression so it sums the
>> Sales
>> figure for the whole location? If not, is there a way to reference a
>> particular textbox on the report?
>> Any help or direction would be greatly appreciated.
>> Thanks!
>> Rick
>>

Friday, March 9, 2012

Refereing a text box

Hello all,
i have a text box in the page footer region that i want to refer to in the
report body. How do i refer it? When i enter the text box name and value it
says cant find text box.
thanks in advance
IshanI believe it is ReportItem!TextBox.Value. Or it least it works that way
when refering to a text box from the report body to a text box in the
footer.|||Name the text box that you want to reference. Ex: txtAnswer
In your footer text box enter =ReportItems!txtAnswer.value
Hope this helps!
"michaelhilding@.gmail.com" wrote:
> I believe it is ReportItem!TextBox.Value. Or it least it works that way
> when refering to a text box from the report body to a text box in the
> footer.
>

Wednesday, March 7, 2012

reducing tempdb

I am trying to reduce the size of my tempdb using the DBCC SHRINKFILE command and get the following error.

DBCC SHRINKFILE: Page 1:1164376 could not be moved because it is a work table page.

How can I get around this so I can shrink the db?

Hi

Please check the following KBA.

http://support.microsoft.com/kb/307487

Jag