SSRS Interactive Sorting in rendered html - sorting

I have a simple report that displays department number and department name with interactive sorting enabled on those two column headers in the tablix.
I am access this report via URL access from an MVC5 application. The report is being rendered in standard html4.0 correctly. I can see the report html in my page with the sort icons in the headers as expected. However, clicking on either column header and i receive an error page from SSRS of rsReportNotReady.
If I browse directly to the report via URL access by itself, interactive sorting works just fine but not when streamed into an mvc view as raw html.
code to render the report as html via url access:
private string GetReportData(string requestUri)
{
string reportData = string.Empty;
HttpWebRequest request = (HttpWebRequest) WebRequest.Create(requestUri);
request.Credentials = CredentialCache.DefaultNetworkCredentials;
HttpWebResponse response = (HttpWebResponse) request.GetResponse();
if (response.StatusCode == HttpStatusCode.OK)
{
Stream receiveStream = response.GetResponseStream();
if (receiveStream != null)
{
StreamReader readStream = response.CharacterSet == null
? new StreamReader(receiveStream)
: new StreamReader(receiveStream, Encoding.GetEncoding(response.CharacterSet));
reportData = readStream.ReadToEnd();
response.Close();
readStream.Close();
}
}
return reportData;
}
example URL to access report http://myreportservername/ReportServer?/EmployeeReports/rptDepartments&rc:Toolbar=False&rc:HTMLFragment=False&rs:Format=HTML4.0
report via url access
report rendered in mvc app
error from sorting via mvc app
Does anyone have any insight into making interactive sorting of an SSRS report work in an MVC application via URL access? No, I cannot use the ReportViewer control either.
Thanks in advance.

I no longer need this resolved. What we were trying to do is not the best way, or easily possible. Ultimately, we switched to using amcharts from https://www.amcharts.com/ to build the charts on the fly with full interactivity.

Related

How to store profile image to SQL server using web API in Xamarin Forms

How to store profile image to SQL server using web API in Xamarin Forms, Here I will get image using xam.plugin.media, I am totally new using web api in xamarin forms, I have login page filed like firstname, lastname, id, profileimage,emailid, phonenumber, My Quesiton is, i want to store profile image and username,pwd,etc using web api(Post Method), Please give me any suggesstion to resolve this issue
For that you have to maeka one api call that save image as a string and convert string into bytes array I give example below.
FileData filedata = await CrossFilePicker.Current.PickFile();
if (filedata != null)
{
Data.Text = filedata.FileName;
byte[] a = filedata.DataArray;
string result = System.Text.Encoding.UTF8.GetString(filedata.DataArray);
//Your api call and save result value
EditorValue.Text = result;
System.Diagnostics.Debug.WriteLine(result);
}

Is there any way of suppressing ‘Do you want to save changes to xxx.pdf before closing’ dialog using ABCpdf

We are reading the adobe form template using ABCpdf , populating form fields with values retrieved from database and amending them into a single PDF document and sending the document back as File stream in the HTTP response to the users in a ASP.net MVC App.
This approach is working fine and PDF documents are getting generated successfully. But when the user choose to open the generated PDF file and try to close it, they are being prompted ‘Do you want to save changes to xxx.pdf before closing’ dialog from Adobe Acrobat. Is there any way of suppressing this message using ABC pdf?.
Following is the code we are using to generate the PDF.
public byte[] GeneratePDF(Employee employee, String TemplatePath)
{
string[] FieldNames;
Doc theDoc;
MemoryStream MSgeneratedPDFFile = new MemoryStream();
//Get the PDF Template and read all the form fields inside the template
theDoc = new Doc();
theDoc.Read(HttpContext.Current.Server.MapPath(TemplatePath));
FieldNames = theDoc.Form.GetFieldNames();
//Navigate through each Form field and populate employee details
foreach (string FieldName in FieldNames)
{
Field theField = theDoc.Form[FieldName];
switch (FieldName)
{
case "Your_First_Name":
theField.Value = employee.FirstName;
break;
default:
theField.Value = theField.Name;
break;
}
//Remove Form Fields and replace them with text
theField.Focus();
theDoc.Color.String = "240 240 255";
theDoc.FillRect();
theDoc.Rect.Height = 12;
theDoc.Color.String = "220 0 0";
theDoc.AddText(theField.Value);
theDoc.Delete(theField.ID);
}
return theDoc.GetData();
}
Today I ran into this problem too, but with a PDF with no form fields. I ran #CharlieNoTomatoes code and confirmed the FieldNames collection was definitely empty.
I stepped through the various stages of my code and found that if I saved the PDF to the file system and opened from there it was fine. Which narrowed it down to the code that took the abcpdf data stream and sent it directly to the user (I normally don't bother actually saving to disk). Found this in the WebSuperGoo docs and it suggested my server might be sending some extra rubbish in the Response causing the file to be corrupted.
Adding Response.End(); did the trick for me. The resulting PDF files no longer displayed the message.
byte[] theData = _thisPdf.Doc.GetData();
var curr = HttpContext.Current;
curr.Response.Clear();
curr.Response.ContentType = "application/pdf";
curr.Response.AddHeader("Content-Disposition", "attachment; filename=blah.pdf");
curr.Response.Charset = "UTF-8";
curr.Response.AddHeader("content-length", theData.Length.ToString());
curr.Response.BinaryWrite(theData);
curr.Response.End();
I ran into this problem, as well. I found a hint about "appearance streams" here:
The PDF contains form fields and the NeedAppearances entry in the interactive form dictionary is set to true. This means that the conforming PDF reader will generate an appearance stream where necessary for form fields in the PDF and as a result the Save button is enabled. If the NeedAppearances entry is set to false then the conforming PDF reader should not generate any new appearance streams. More information about appearance streams in PDF files and how to control them with Debenu Quick PDF Library.
So, I looked for "appearance" things in the websupergoo doc and was able to set some form properties and call a field method to get rid of the "Save changes" message. In the code sample above, it would look like this:
Edit: After exchanging emails with fast-and-helpful WebSuperGoo support about the same message after creating a PDF with AddImageHtml that WASN'T fixed by just setting the form NeedAppearances flag, I added the lines about Catalog and Atom to remove the core document NeedAppearances flag that gets set during AddImageHtml.
public byte[] GeneratePDF(Employee employee, String TemplatePath)
{
string[] FieldNames;
Doc theDoc;
MemoryStream MSgeneratedPDFFile = new MemoryStream();
//Get the PDF Template and read all the form fields inside the template
theDoc = new Doc();
theDoc.Read(HttpContext.Current.Server.MapPath(TemplatePath));
FieldNames = theDoc.Form.GetFieldNames();
//Tell PDF viewer to not create its own appearances
theDoc.Form.NeedAppearances = false;
//Generate appearances when needed
theDoc.Form.GenerateAppearances = true;
//Navigate through each Form field and populate employee details
foreach (string FieldName in FieldNames)
{
Field theField = theDoc.Form[FieldName];
switch (FieldName)
{
case "Your_First_Name":
theField.Value = employee.FirstName;
break;
default:
theField.Value = theField.Name;
break;
}
//Update the appearance for the field
theField.UpdateAppearance();
//Remove Form Fields and replace them with text
theField.Focus();
theDoc.Color.String = "240 240 255";
theDoc.FillRect();
theDoc.Rect.Height = 12;
theDoc.Color.String = "220 0 0";
theDoc.AddText(theField.Value);
theDoc.Delete(theField.ID);
}
Catalog cat = theDoc.ObjectSoup.Catalog;
Atom.RemoveItem(cat.Resolve(Atom.GetItem(cat.Atom, "AcroForm")), "NeedAppearances");
return theDoc.GetData();
}

How to access Endeca keyword redirect results in the JSP layer with ATG?

I'm working on a web application with Oracle ATG 10.1.2 and Endeca 3.1.1 (without Endeca Experience Manager), and am trying to get keyword redirect functionality to work.
Ultimately, what I'm trying to accomplish is to get access to the keyword redirect information returned from Endeca (if there was any) in my JSP layer, so I can redirect the user to the keyword redirect URL, and/or display that URL as part of the rendered page.
To get results from Endeca, we are using the /services/guidedsearch packaged service (as described in on p51 of the Assembler Application Developer's Guide (v3.1.1).
If I use my browser to directly access the raw Guided Search output from the Endeca MDEX server, I can see my guided search entry and URL in the endeca:redirect property in the returned XML. I can also see the guided search entry with no problem in the Endeca JSP Reference Application ("orange app").
However, when I use the ATG InvokeAssembler droplet to get results from Endeca, the endeca:redirect entry doesn't seem to be included in the response. The ContentItem map that gets returned only has the following keys:
#type, name, navigation, breadcrumbs, resultsList, searchAdjustments, zones, endeca:siteRootPath, endeca:contentPath
There's no endeca:redirect key like I can see in the raw /services/guidedsearch XML output.
Here's the relevant snippet of my JSP code:
<dsp:droplet name="/atg/endeca/assembler/droplet/InvokeAssembler">
<dsp:param name="includePath" value="/services/guidedsearch" />
<dsp:oparam name="output">
<dsp:getvalueof param="contentItem" var="contentItem" vartype="com.endeca.infront.assembler.ContentItem" />
</dsp:oparam>
</dsp:droplet>
How can I access the keyword redirect information returned from Endeca?
You could also develop your own RedirectAwareHandler and simply extract the redirect from the SupplementList.
public ContentItem process(ContentItem pContentItem) throws CartridgeHandlerException {
ENEQueryResults executeMdexRequest = executeMdexRequest(mMdexRequest);
Object redirectURL = null;
if (executeMdexRequest.getNavigation() != null && executeMdexRequest.getNavigation().getSupplements() != null){
SupplementList supplements = executeMdexRequest.getNavigation().getSupplements();
Supplement supplement = null;
for (Object object : supplements) {
if (object instanceof Supplement) {
supplement = (Supplement) object;
if (supplement.getProperties() != null) {
redirectURL = supplement.getProperties().get("DGraph.KeywordRedirectUrl");
if (redirectURL != null) {
break;
}
}
}
}
}
//And now do your redirect
}
According to Oracle Support doc 1530390.1, the problem is that in ATG 10.1.2, the InvokeAssembler droplet is internally coded to use an Endeca ContentInclude object (which doesn't support keyword redirects), instead of using RedirectAwareContentIncludeHandler (which does).
Per that knowledge document, Hotfix p16099140 can be requested from Oracle Support to address this.

How can I access form post parameters from a web test recorder plugin

Using Visual Studio 2012 to create web tests.
How can I access form post parameters from a web test recorder plugin? Most aspects of a recorded webtest are visible via Visual Studio's intelisense or from MSDN, but I cannot find the form post parameters.
I am testing a web site that uses form post parameters in an "interesting" manner. So far we have hand-edited the XML in the .webtest file, but that is error prone. So I would like to modify them in a web test recorder plugin.
Form post parameters can be accessed in a web test recorder plugin via the body field of a web request, but the body needs to be cast to the correct type. A recorder plugin provides has the recorded web test as a (field of a) parameter, the Items of the test include the individual requests. They also include comments and so on. An Item that is a WebTestRequest may have a Body field that, after casting, provides the form post parameters. This code shows a plugin that displays some details of the form post parameters via a WriteLine method that is not shown here. The inner loop can be replaced with code to modify, or delete or add new form post parameters.
public override void PostWebTestRecording(object sender, PostWebTestRecordingEventArgs e)
{
foreach (WebTestItem wti in e.RecordedWebTest.Items)
{
WebTestRequest wtiwtr = wti as WebTestRequest;
if (wtiwtr != null)
{
FormPostHttpBody formBody = wtiwtr.Body as FormPostHttpBody;
if (formBody == null)
{
// no formBody.
}
else
{
WriteLine("Have {0} form post parameters", formBody.FormPostParameters.Count);
foreach (FormPostParameter fpp in formBody.FormPostParameters)
{
WriteLine("FPP '{0}' = '{1}'", fpp.Name, fpp.Value);
}
}
}
}
}
Several other parts of the recorded web test can be accessed via these casts of wti in the code.
Comment wtic = wti as Comment;
IncludedWebTest wtiiwt = wti as IncludedWebTest;
SharepointInformation wtispi = wti as SharepointInformation;
TransactionTimer wtitt = wti as TransactionTimer;
WebTestConditionalConstruct wtiwtcc = wti as WebTestConditionalConstruct;
It is a little ugly but I was able to find it while debugging a plugin that uses the PreRequestDataBinding method. Putting my mouse over 'e', expand request -> body -> [Microsoft.VisualStudio.TestTools.WebTesting.FormPostHttpBody] -> FormPostParameters. But due to the protection level you won't be able to edit the value.
What I ended up doing was convert a web test into a coded web test. You can do this by right-clicking on the top level of the web test designer view, then choosing Generate Code. Looking at the coded web test, will allow you to modify the form post parameters. Look for something like this...
request1Body.FormPostParameters.Add("YourFormPostName", "value");
You can add form post parameter like this in PreRequest method of WebTestRequestPlugin -
FormPostHttpBody form = new FormPostHttpBody();
FormPostParameter par = new FormPostParameter();
par.Name = "name";
par.Value = "1";
form.add(par);
e.Request.Body = form;

sending a selected value from a dropdownlist to a servlet with xhr

I am trying to send the clicked value of a dropdown list to my servlet to run a SQL query using the value received. To do it I am using Ajax like that:
function showProject(prj) {
xmlhttp = GetXmlHttpObject();
if (xmlhttp == null) {
alert ("Browser does not support HTTP Request");
return;
}
var url = "ServletxmlGenerator.java";
idprj = prj.options[prj.selectedIndex].value;
url = url + "?idprj=" + idprj;
xmlhttp.onreadystatechange = stateChanged;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}
The servlet when
String projectcode=(String) request.getParameter("idprj");
returns null.
When I select a value from the JSP that construct the dropdown list and from which the function showProject is handled the same thing is happned. It returns always null. So the parameter(idprj) is not passed anyway. How can I handle with this. I need to send the selected value to the servlet to run my SQL query.
Just debug your Javascript code. What does for example this say?
idprj = prj.options[prj.selectedIndex].value;
alert(idprj);
For better debugging, I suggest to pick Firebug.
Also debug your Servlet by executing it independently (just enter its URL in browser address bar like http://example.com/contextname/ServletxmlGenerator.java?idprj=1) and by tracking the request and Servelt code.

Resources