ObjectDataSource.Select with Parameters Time Out - asp.net-3.5

I'm using an ObjectDataSource with a 2008 ReportViewer control and Linq to CSV. The ODS has two parameters (the SQL is spelled out in an XSD file with a table adapter). The Reportviewer takes a very long time to render the output after a button is clicked to generate the report. That's my first problem. Even though it works (most of the time), the processing time worries me, and subsequent requests don't seem to be changing the results shown on the screen. The next issue is that when I go to export the ODS to CSV I'm getting a time out exception on the select method of the ODS (shown below). This works for ODS without parameters, but it seems like now that I've added parameters that it doesn't want to cooperate. I'm fresh out of ideas, any thoughts?
<asp:ObjectDataSource ID="obsGetDataAllCustomers" runat="server"
SelectMethod="GetDataAllCustomers"
TypeName="my.myAdapter.AllCustomers"
OldValuesParameterFormatString="original_{0}" >
<SelectParameters>
<asp:ControlParameter ControlID="StartDate" Name="Start" PropertyName="Text"
Type="DateTime" />
<asp:ControlParameter ControlID="EndDate" Name="_End" PropertyName="Text"
Type="DateTime" />
</SelectParameters>
</asp:ObjectDataSource>
After button click to view report -
rvAllCustomers.LocalReport.Refresh()
Export to CSV (adding the items returned to a list which is then processed by working code) -
For Each dr As DataRow In CType(obs.Select(), DataView).Table.Rows
l.Add(New FullOrderOutput(dr))
Next

Unfortunately (or fortunately I suppose in this case - loads of data here) I didn't find a direct solution to this problem. Instead, I used a query (probably using a SQLAdapter or something like that - it's been a while) and specified the parameters manually within that bit of code, then if I recall, supplied the report's datasource the adapter.

Related

Passing an external parameter from a jsp to an xsl (Eclipse)

Setting the scene:
I'm working on a webapp in Eclipse, with a bunch of JSPs and XSLs. And I need to hide some features depending on some users' attributes. This is the third job in the series.
For the previous 2 jobs, I was able to achieve my goals because either the required changes were on JSPs (straightforward) or on XSLs for which the objects existed.
I.e. We have the following sequence:
- searchForm.jsp (a form with some criteria you set up and submit),
- resultsList.jsp (a list of search results - clicking on any result brings the full record for the result),
- displayItem.jsp (the full record),
- record.xsl (the xsl that transforms displayItem.jsp).
Thus for the 2 previous jobs, the features I needed to hide were either on these JSPs themselves or on the xsl, in which case the (relevant) JSPs had:
<c:set target="${item}" property="xsltParameter" value="xxxx=Y"/>
where 'item' is an existing object and 'xxxx' a (usually but not necessarily global) parameter defined in the xsl.
For example:
<xsl:param name="xxxx">N</xsl:param>
Thus, if my changes were on the xsl, I would reuse the 'item' object to pass on my parameter and process it in the XSL(s).
E.g. I'd put on the jsp:
<c:set target="${item}" property="xsltParameter" value="abcd=AAA"/>
and add to the xsl:
<xsl:param name="abcd"></xsl:param>
This way I was able to pass my own parameters to the xsl.
For this last job however:
- The XSL (filters.xsl) is quite short and self-contained.
- It appears on the same page as resultsList.jsp, (therefore after searchForm.jsp) but has no connection I can see with it.
- On the JSPs, there's NO (appropriate) target object I can (re)use.
- I've already tried on a/the JSP the way I know to create variables/parameters:
<c:set var="xyz" value="${abcd}"/>
but this doesn't seem to work (when I create a corresponding xyz global parameter in filters.xsl).
My issues are:
- I'm struggling to create an object (if that's what I need to do).
- I may need to do something else, but I'm not sure what (hence my post).
Plan B
In desperation, with plan B I'm creating as a proof-of-concept, a static xml file (param-val.xml), in the same location as the XSLs, in which I put my external parameter/criterion:
<paramroot>
<paramval>abcd</paramval>
</paramroot>
What I'd like to do is using the document() function, extract this parameter and use it either within filters.xsl if possible or otherwise a go-between prefilters.xsl that filters.xsl would import. And this is where I'd need some help/tips/etc.
<xsl:param name="theXML" select="'prefilters.xml'" />
<xsl:variable name="myDoc" select="document($theXML)" />
I've been reading stuff on the web and tested a few things, but I'm stuck (rusty on some topics and learning others). How can I grab and use the 'abcd' in either filters or prefilters?
Any suggestions on how best to handle this?
Sorry for the lenghty post. Any help would be greatly appreciated.
Many thanks and regards.

Crystal Reports - suppress subreport parameter prompts

I have a Crystal report with several subreports linked on a common field - all working great. Now must add another, very complex, existing report as a new sub. This report's data source code stretches several pages. It also has over a dozen parameters which are further imbedded in numerous formula fields through out. That said, it runs fine and has a parameter that links with the main report. Unfortunately all the other parameter prompts is supremely annoying.
I've searched high and low for a method to accept default values without prompts but Crystal doesn't seem to accommodate that notion.
Revising the report to remove all the unneeded parameters would be extremely painful and simply not an option.
I'm hoping to find an alternate way to pass the parameter values to prevent the prompt. I'm aware of the SetParameterValue() method of the ReportDocument class but not sure how to use it. I've found examples of how to use it with C#, VS, ASP.net, etc., none of which work for an end user like myself.
Could the data source command itself be used?
Much thanks for any recommendations, guidance or thoughts!
With Command Level prompts, you would never be able to change the prompt values with the CR Viewer.
If the report is supposed to be viewed in the CR Viewer and you need the functionality or changing prompt values, try this:
1) Remove Command Level prompts
2) Create the Data prompt in the report from the Field Explorer
3) Create a Record Selection formula like this:
{date_field} = {?Date_prompt}
under Report > Selection Formulas > Saved data
4) Save the report with data
Try this...

Set xlsx to recalculate formulae on open

I am generating xlsx files and would like to not have to compute the values of all formulae during this process.
That is, I would like to set <v> to 0 (or omit it) for cells with an <f>, and have Excel fill in the values when it is opened.
One suggestion was to have a macro run Calculate on startup, but have been unable to find a complete guide on how to do this with signed macros to avoid prompting the user. A flag you can set somewhere within the xlsx would be far better.
Edit: I'm not looking for answers that involve using Office programs to make changes. I am looking for file format details.
The Python module XlsxWriter sets the formula <v> value to 0 (unless the actual value is known) and the <calcPr> fullCalcOnLoad attribute to true in the xl/workbook.xml file:
<calcPr fullCalcOnLoad="1"/>
This works for all Excel and OpenOffice, LibreOffice, Google Docs and Gnumeric versions that I have tested.
The place it won't work is for non-spreadsheet applications that cannot re-calculate the formula value such as file viewers.
If calculation mode is set to automatic, Excel always (re)calculates workbooks on open.
So, just generate your files with calculation mode set to "Automatic".
In xl/workbook.xml, add following node to workbook node:
<calcPr calcMode="auto"/>
Also check Description of how Excel determines the current mode of calculation.
You can use macros as suggested, however you will create a less secure and less compatible workbook without avoiding user interaction to force calculation.
If you opt by using VBA, you may Application.Calculate in Workbook_Open event.
In your XML contents, simply omit the <v> entity in each cell that have a formula, this will force Ms Excel to actualize the formula whatever the Excel options are.
Instead of:
<c r="B2" s="1">
<f>SUM(A1:C1)</f>
<v>6</v>
</c>
Have:
<c r="B2" s="1">
<f>SUM(A1:C1)</f>
</c>
If you have to actualize formula in an already given XML contents, then you can code easily a small parser that search for each <c> entities. If the <c> entity has a <f> entity, then delete its <v> entity.
Faced the same problem when exporting xlsx'es via openxml (with fastest SAX + template file approach w/o zip stream rewinds).
Despite Calculation option=Automatic, no recalculation on opening the file.
Furthermore no recalculation via Calculate Now and Calculate Sheet buttons.
Only upon selecting the cell and pressing enter ;(
Original formula: SUM(A3:A999)
Solution:
Create an internal hidden sheet
Place end row number (999 in my case) into any cell in hidden sheet (P1 in my case)
Reference row number in the cell via INDIRECT operator
Final formula: SUM(A3:INDIRECT("A"&Internal!P1))
Please refer to the attached gifs
before.gif
after.gif
P.S.
Theoretically, in P1 you can implement dynamic row number calculation via smth like =LOOKUP(2;1/(Sheet1!A:A<>"");ROW(Sheet1!A:A)), but my customers were satisfied with hardcoded row number solution

How to change the SSRS input parameters position in report

My SSRS report contains 7 input parameters and while running my report the size of the parameter(i.e. length) is increasing.
One of my input parameter(drop down list) may contain 100 characters so the size is not constant but i want to place all parameters in 2 lines or 3 lines(in a row).
Now it is coming 2 parameters per a row
Please advice
As gbn indicates, it's not easy to change the built in report server method of presenting the parameters. SSRS likes to always use two parameters per line, presented in the order that they exist in the report (which must match the dependency order.)
So the alternatives that gbn mentions: Both involve building a "Wrapper" application: some custom code or a web page that you can code however you like to get the parameters. Then you call Reporting Services, either in code or by passing a formatted URL with your parameters. The report can be displayed in a frame, new window, or passed as a stream to where ever you'd like.
The URL access is pretty straightforward and reliable: I often use it either by hand (to create "favorites") or in code.
http://msdn.microsoft.com/en-us/library/ms153586.aspx
For what you are looking for, these might be more work than you expected, but they will be extremely flexible for your interface.
Jamie
You can certainly do that, just right click on the RDL file in the solution explorer and select view code. then move the XML tags named <ReportParameter Name="Nameofparameter"> under <ReportParameters> according to where ever you want to position. And then save it. thats it!!!
The report parameters are kind of floating in values of 2, so if u have 4 report parameters then it will be shown as 1,2 next line 3,4. Best of luck!!
Use ASP.NET for the paramaters and a ReportViewer control or URL access to render. Seriously.
I don't know of any option to present parameters any way other then the default
I believe you could try using jQuery. The report parameters are rendered in a table under a div tag with class sqlrv-ParameterContainer. Write a jQuery or JavaScript function that will extract the full innerHTML from this div ie. the table content and then extract the table row information like the <label> or <input> tags.
Create your desired table structure with <table><tr><td>{extracted sections}</td><td></td></tr></table> or leave it to your requirement...
Then just append this new HTML structure in place of the original default structure.
In jQuery it will be like
$(".sqlrv-ParameterContainer").html();
which will give you the entire table structure that comes inside the parameter. Use XML parsing and get the input controls and all. Extract these controls as-is, don't change anything.
$(".sqlrv-ParameterContainer table").remove(); // it will remove the SSRS rendered default table from DOM
$(".sqlrv-ParameterContainer table").appendChild('<table><tr>......</tr></table>'); // Append your custom html structure here....
This was something that came to my mind quickly... I would suggest you test it... :)
This doesn't help the OP with SSRS-2008 but in case it helps others - Microsoft have improved this in SSRS 2016 - parameters can now be easily managed via the GUI in Report Builder / Visual studio:
https://www.intertech.com/ssrs-parameters-2016-update/

"Document has no pages" on iReport and nothing on OpenReports

I am having an issue with JasperReports I can not solve. I am using Eclipse, OpenReports 3.2 and IReport 3.7
The issue I am having is that the report does nothing. When I preview the report in IReport I can at least get a "Document has no pages" message but when I try to open it using OpenReports it doesn't do anything. I get the open reports header and the copyright message but nothing between them.
I was able to track it down to line 150 in ReportRunAction.java in OpenReports. That line is:
jasperPrint = jasperEngine.fillReport(reportInput);
At least that is the line the page dies on. It trips the catch block that the line is inside of but the error is empty. When I try to print the description it is null. I can't swear that the issue isn't that parameter. Through looking around all I have been able to find is something about how the report needs to be compiled with the same version of the jasperreports.jar that OpenReports uses. I have no idea how to tell if/what version of jasper reports is being bundled into the .jasper file though.
Is that my problem? If so how do I tell/set the version of the jar that gets bundled? If not; help!
The no pages messages comes out when the report has not records or you discarded all of them with a wrong filter expression.
There are a couple of things you can try:
set the filter expression to:
new Boolean (true)
This will in some way reset your filter expression.
Right click your jasper report
properties
find more...
and Set the report property "When no data" to "All sections no details" so you can see at least the rest of the report.
Thanks.
If you are using the Detail Bandeport, then you will need a Data Query for the report. Since it's returning "No Pages" in iReport, then you either don't have a query. Or simply your query is not returning any rows.
In old iReport, from Data menu, choose Report Query and write your query here. If you want only one record (i.e. Detail band only one time) you can use a dummy table. Like:
SELECT 'a' FROM DUMMY
Otherwise, if you don't want to use the Detail Band, you have the option to view the other bands without using a query. From Edit menu, choose Report Properties, under More... tab, set the flag When no data to All Sections, no detail
Your problem is not exceptions or errors, it's just no data to show.
Any Empty Datasource will do the trick too.
I ran into the same error when using IReports when I had a subreport that only contained other subreports and no actual query. Adding a dummy query as medopal suggests fixes the no pages error and allows things to run correctly.
See also: http://jasperforge.org/plugins/espforum/view.php?group_id=83&forumid=101&topicid=49315
I've been facing this error for a while. In my case, this error occurred because of an image. If you have images in your report file, you will be forced to fill image with valid data when you wanna use report. If you don't, you will see this error "Document has no page". To address this problem just set "on error type" field in properties window (just click on image you'll see the property window) to "blank".
Strong wish.
I had same problem and got after searching problem, that I did not provide password to connection.
so I add these lines to my java code.
Class.forName("com.mysql.jdbc.Driver");
con =DriverManager.getConnection("jdbc:mysql://localhost:3306/stock_mngt","root","your password");
now my code works.