I created some reports in Visual Studio 2015 with all the latest updates. However, when I try to deploy the reports I get this message:
The definition of this report is not valid or supported by this version of Reporting Services.
11:40:28 Error
The report definition may have been created with a later version of Reporting Services, or contain content that is not
11:40:28 Error
well-formed or not valid based on Reporting Services schemas. Details: The report definition has an invalid target
11:40:28 Error
namespace 'http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition' which cannot be upgraded.
The first lines of the .rdl file are set up like this:
<?xml version="1.0" encoding="utf-8"?>
<Report MustUnderstand="df"
xmlns="http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition"
xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner"
xmlns:df="http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition/defaultfontfamily">
Can I change the schema definition? If so, to what? I tried just changing 2016 to 2014 or 2012, but neither worked.
Is there a place I can go to see valid definitions?
I actually ran into a similar problem where a change I needed to make resulted in an "Undocumented Error/Invalid RDL Structure" error in 2016, so I edited the RDL file so I could open it in an earlier version and make my changes. Not too hard, but you need to make a couple of tag edits.
For new reports you should probably just use an older version, but for existing reports you can do this: (I reverted to 2008)
Change the Report tag:
Remove MustUnderstand="df"
Change the xmlns value to "http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition"
Delete the xmlns:df attribute.
Delete the entire "ReportParametersLayout" block.
Delete the "df" tag and its content.
Delete the "ReportSections" and "ReportSection" opening and closing tags (not the content).
Actually wrote some superhackish code to do this as part of a blog post, but the manual edit is simple enough.
The settings below should be set to your sepecific version of SSRS, and then take the RDL from the \bin directory
Or, after updating the TargetServerVersion, simply use right click | deploy from the rdl.
The accepted answer is significantly more difficult/prone to error/unlikely to work across multiple versions of ssrs, and needs to be applied each time you change the rdl.
I had the same issue when switching to VS2017 and installed Report Designer Version 14.2.
For me only 3 steps needed to fix the issue.
1: Set Change the xmlns to "http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition"
2: Remove ReportSections" and "ReportSection" (Only Tags).
3: Remove report ReportParametersLayout section.
The only thing you need to memorize is to point xmlns to 2008/01
Other 2 steps can be seen in the error message after you change to 2008/01 and try to run the report.
If you are having trouble in a Visual Studo 2017 C# desktop application with LocalReport (RDLC), please see this answer:
https://stackoverflow.com/a/45149488/6732525
I recently ran into this issue as well. I found that I only needed to change two items in the .rdl file in question.
Change FROM:
Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner"
TO:
Report xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner" xmlns:cl="http://schemas.microsoft.com/sqlserver/reporting/2010/01/componentdefinition" xmlns="http://schemas.microsoft.com/sqlserver/reporting/2010/01/reportdefinition"
Unlike other responses, I needed 2010 instead of 2008. I would check an .rdl file that you have already deployed.
Remove the "ReportParametersLayout" block.
Note: If I removed ReportSections block, it did not work as others have noted.
I ran in to same problem and this is how I solved it,
Set the "TargetServerVersion" property on report project properties to be your old version of reporting server.
Build the project.
Get the report in the bin folder and deploy to the old reporting server.
Your source reports format and namespace will be updated to latest version. But bin folder reports will be build to be compatible with targeted reporting server version.
I have automated this task.
create a form with a textbox named "TextBoxFile" and a button.
In the code of the click button:
Dim xmlDoc As New XmlDocument()
xmlDoc.Load(TextBoxFile.Text)
Dim root = xmlDoc.DocumentElement
For Each elel As XmlNode In root.ChildNodes
Debug.WriteLine(elel.Name & " " & elel.NodeType)
Next
If root.Attributes()("xmlns").Value <> "http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition" Then
root.Attributes()("xmlns").Value = "http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition"
End If
Dim nsmgr = New XmlNamespaceManager(xmlDoc.NameTable)
nsmgr.AddNamespace("bk", "http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition")
Dim autoRefreshElements = root.GetElementsByTagName("AutoRefresh")
While autoRefreshElements.Count > 0
root.RemoveChild(autoRefreshElements(0))
End While
Dim ReportParametersLayout = root.GetElementsByTagName("ReportParametersLayout")
While ReportParametersLayout.Count > 0
root.RemoveChild(ReportParametersLayout(0))
End While
Dim ReportSections = root.GetElementsByTagName("ReportSections")
If ReportSections.Count > 0 Then
' Move content of ReportSections just below the block.
Dim ReportSection = ReportSections(0).ChildNodes()
' First, copy the elements after
Dim precedent = ReportSections(0)
For Each child As XmlNode In ReportSection(0).ChildNodes
Dim clone = child.Clone
root.InsertAfter(clone, precedent)
precedent = clone
Next
' After deleting the existing block
While ReportSections.Count > 0
root.RemoveChild(ReportSections(0))
End While
End If
xmlDoc.Save(TextBoxFile.Text)
MsgBox("Ok")
The most simple and straight forward solution. I would suggest you to find Microsoft.ReportingServices.ReportViewerControl.WebForms in Manage NuGet Packages of the current project and update this dll version to latest version.
Navigate from VS menu: Tools > NuGet Package Manager > Manage NuGet Packages for Solution
Login through the local admin account and correct computer objects by deleting and creating those computer objects.
Related
In Google Data Studio, I am trying to group different stages and assign them to a group for viewing in a sales funnel. The data are all strings. What I'm confused about is the fact that this data works just 1 or 2 weeks ago and the graph is already there. However, when I try to change the grouping, it shows the error "Invalid formula" or "Failed to create field. Please try again later"
I have also tried to clone this code to create another field and it doesn't work at all. Have anyone encountered this problem and found a solution?
Here is the associated code:
CASE
WHEN Stage IN ("Interested", "Good Lead", "Good Leads") THEN "Prospected"
WHEN Stage IN ("Attempted 1st", "Attempted 2nd") THEN "Attempted"
WHEN Stage IN ("Contacted", "Lukewarm Lead", "Warm Lead", "Cold Lead", "Qualified Lead") THEN "Contacted"
WHEN Stage IN ("Course Chosen") THEN "Docs Collection"
WHEN Stage IN ("Document Collected", "School Applied") THEN "School Applied"
WHEN Stage IN ("Paid") THEN "Paid"
WHEN Stage IN ("Visa Applied") THEN "Visa Application"
WHEN Stage IN ("Finished") THEN "Won"
ELSE "0"
END
Created a Google Data Studio Report (Google Sheets Embedded) to try out the CASE statement, and it works as expected.
Is the data structured as displayed in the Report and Visual below?
What's the Data Source (e.g. Google Sheets)?
Have you tried Refreshing the Data Source?
What browser are you on (e.g. Chrome)?
In addition to reloading the page (F5), you could try a Hard Reload (Ctrl + F5);
If the formula was created at the Data Source-level, you could try whether it works when creating it at the Chart-level (as shown in the visual below).
The problem:
I have an SSIS package that loops through 100+ Excel files and reads the data, then copies the contents over to a SQL Server Table. In these Excel files, this one column has hyperlinks. The column text itself says something like DSH-LN-4, but clicking on it in Excel opens up a folder that contains some images. How do I copy the underlying link in this column rather than the actual text in the cells?
What have I tried so far:
I haven't really tried anything because I found absolutely no resources on how to do this in SSIS. Manually adding a column to the Excel files is NOT possible, since there are 100's of files. The only resource I found was in this SO Question, but this does not indicate the process of doing this without manually manipulating the Excel files.
What I would like:
In my ForEach loop container, I have a data flow task that gets the Excel contents and shoves it into the SQL Table. The column that contains hyperlinks is called PhotoReference (since these hyperlinks open the folder that has the photos). I would like this PhotoReference column to copy over the underlying hyperlink of the cell and add that to the SQL column.
For instance, I want the PhotoReference column to contain this:
www.companyname.box.com/asjdfbgkjb134kjbsdafo2bm21n4bk
If I can manage to do this, my Power BI report running off of this underlying data could contain a clickable text that would open the image directly.
Any help would be appreciated.
UPDATE:
I was able to try two different methods to extract the hyperlinks from my column, but each of these have their own issues:
Method 1: I added a Script Task component to my ForEach container and as I loop through each Excel file, used Microsoft.Office.Interop.Excel.Hyperlinks assembly to get the hyperlink from my Excel column. BUT, I don't know what to do with it after. I figured the only thing to do is to overwrite the Excel columns' content with my extracted hyperlink, but I really rather not change my Excel files in any manner.
Method 2: I added a Script Component object inside my data flow task in between my Excel source and SQL Destination. In this method, I could not get nearly as far because the Input0_ProcessInputRow method that is auto-generated has the argument Row of type Input0Buffer. I am not able to apply any Microsoft.Office.Interop.Excel properties to my Input0Buffer object. So I am stuck.
If you have to right to alter the excel files, you can simply add a Script Task before the data flow task to replace the URL column value with the hyperlink.
In this answer, I will provide a step-by-step solution to solve this problem:
Creating Excel samples
First of all, I created some Excel files with the following columns:
First name (text)
Last name (text)
Age (number)
Photo (hyperlink)
The file content looks like the following:
Creating the SSIS package
First of all, You must add an Excel connection manager that link to one of the Excel files you need to import. And an OLE DB connection manager to connect to the SQL Server instance.
You must add a SSIS variable of type string, to store the Excel file path when using the foreach enumerator
Add a Foreach loop container and configure it to loop over the Excel files as mentioned in the images below:
Within the Foreach Loop container add a Script Task and a Data flow task as mentioned in the image below:
Now, Open the data flow task and add an Excel source and an OLE DB destination and configure the columns mapping between them.
Open the Script Task configuration, and select the ExcelFilePath variable (created in step 2) as a readonly variable as mentioned in the image below:
Now, open the Script editor and in the solution explorer window, right-click on the references icon and click on "Add Reference..."
When the Add reference catalog appears, click on the COM tab, and search for Excel, then you should select the Excel Object Library from the results as shown in the following image:
Also, make sure to add Microsoft.CSharp.dll reference.
On the top of the script you should add the following line:
using Excel = Microsoft.Office.Interop.Excel;
using System.Runtime.InteropServices;
In the Main() function add the following lines:
Excel.Application excel = new Excel.Application();
string originalPath = Dts.Variables["User::ExcelFilePath"].Value.ToString();
Excel.Workbook workbook = excel.Workbooks.Open(originalPath);
Excel.Worksheet worksheet = (Excel.Worksheet)workbook.Worksheets[1];
Excel.Range usedRange = worksheet.UsedRange;
int intURLColidx = 0;
excel.Visible = false;
excel.DisplayAlerts = false;
for (int i = 1; i <= usedRange.Columns.Count; i++)
{
if ((worksheet.Cells[1, i] as Excel.Range).Value != null &&
(string)(worksheet.Cells[1, i] as Excel.Range).Value == "Photo")
{
intURLColidx = i;
break;
}
}
for (int i = 2; i <= usedRange.Rows.Count; i++)
{
if ((worksheet.Cells[i, intURLColidx] as Excel.Range).Hyperlinks.Count > 0)
{
(worksheet.Cells[i, intURLColidx] as Excel.Range).Value2 = (worksheet.Cells[i, intURLColidx] as Excel.Range).Hyperlinks.Item[1].Address.ToString();
}
}
workbook.Save();
Marshal.FinalReleaseComObject(worksheet);
workbook.Close(Type.Missing, Type.Missing, Type.Missing);
Marshal.FinalReleaseComObject(workbook);
excel.Quit();
Marshal.FinalReleaseComObject(excel);
Dts.TaskResult = (int)ScriptResults.Success;
In the lines above, first we searched for the column index that contains the hyperlink (in this example the column name is "Photo", then we will check for each line if the Hyperlink address is not empty we will replace the column value with this hyperlink address)
Finally, make sure to configure the Excel connection manager to read the file path from the created variable value (Step 2) using expressions:
Experiments
After running the package, if we open an Excel file we will see that the Cell value is replaced with the URL:
And as shown in the image below, data are imported successfully to SQL Server:
References
Missing compiler required member 'microsoft.csharp.runtimebinder.binder.convert'
Extracting a URL from hyperlinked text in Excel cell
Excel interop prevent showing password dialog
What you will probably need to do is some hackery involving the Excel COM API, or macros. In fact, since you should stay away from using the Office COM API in SSIS.
You could pre-process excel to take that value with non-standard operations in SSIS, like using script component.
These are the steps you need to follow to import that data using the Script component:
Drag and drop a script component and select "source" as the script option type.
By default the script language is Microsoft Visual C# 2008 and I have done this sample with Microsoft Visual Basic 2008. Change this if you need to.
Define your output columns with the correct data type in "data type properties"
Edit the script. In the IDE you should add reference:
Microsoft.Excel 11.0 Object Library
(if that reference doesn´t work, try with Microsoft.Excel 5.0 Object Library)
Finally, write some code:
Imports Microsoft.Office.Interop.Excel
Public Overrides Sub getHyperlink()
Dim oExcel As Object = CreateObject("Excel.Application")
Dim FileName As String
FileName = Variables.FileName
Dim oBook As Object = oExcel.Workbooks.Open(FileName)
Dim oSheet As Object = oBook.Worksheets(1)
Output0Buffer.AddRow()
// change A1 with your correct col & row
Output0Buffer.Address = cell.range("A1").Hyperlinks(1).Address & "#" & cell.range("A1").Hyperlinks(1).SubAddress
End Sub
(keep in mind that it is a code that may not run, it is by way of illustration)
You could see code in C# here:
C# Script in SSIS Script Task to convert Excel Column in "Text" Format to "General"
The only issue with the script method is you need to have the Excel
runtime installed.
More about script component here:
https://www.tutorialgateway.org/ssis-script-component-as-transformation/
I am new to Oracle Apex 5.1, and I have been asked to implement a button that when clicked, the user gets (downloads) a .doc file of an Interactive report.
I have noticed that the Interactive Report gives you the option to download it as .pdf, .xls, and so, but I need it to be a Word (.doc) file.
In addition, the file must be in a specific format (with heading, indentation, font, etc.) that I was given (as a template) in a Word file.
Any help would be appreciated.
Additional Information: I was able to open the template (.doc) file in NotePad++ and get the <html> version of it, so I could edit it in both NotePad++ and Word.
One of the best actually to do that is APEX OFFICE PRINT(AOP) but isn't free licence.
otherwise you can check this solution
How do we export a ms-word (or rtf) document (from a web browser) to generated by pl/sql?
I end up finding information in this page: http://davidsgale.com/apex-how-to-download-a-file/ and I wrote this code:
declare
l_clob clob;
begin
l_clob := null;
sys.htp.init;
sys.owa_util.mime_header('application/vnd.ms-word', FALSE,'utf-8');
sys.htp.p('Content-length: ' || sys.dbms_lob.getlength( l_clob ));
sys.htp.p('Content-Disposition: inline; filename="test_file.doc"' );
sys.owa_util.http_header_close;
sys.htp.p(SET_DOC_HEADER);
sys.htp.p(SET_TABLE_HEADER);
sys.htp.p(ADD_TABLE_ENTRY("arguments"));
sys.htp.p(SET_TABLE_FOOTER);
sys.wpg_docload.download_file(l_clob);
apex_application.stop_apex_engine;
exception when others then
--sys.htp.prn('error: '||sqlerrm);
apex_application.stop_apex_engine;
end;
It works, but I had to create functions in the SQL Workshop because writting a table in html is really long.
I followed the following tutorial to help me create a datagrid (http://www.asp.net/web-pages/videos/aspnet-razor-pages/displaying-data-in-a-grid), however, I keep getting the error in the title under the word database. I've tried replacing it with the name of my database (Products) however that didnt work. Does anyone know why it could be happening? This piece of code sits at the top of my view page:
#{
var _db = database.open("Products");
var selectQueryString = "SELECT * FROM Products ORDER BY DateBought, SortOrder";
var data = _db.query(selectQueryString);
var grid = new WebGrid(Model);
}
When I check the values I receive in the drop down menu when I type var _db = datab.. I only have the following available:
Databinding, Databinder, DatabindingCollection, Databindinghandlerattribute, databindingliteralcontrol, Designerdataboundliteralcontrol, Idatabindingsassessor
You need to add a Reference to WebMatrix.Data.dll
Database class is part of WebMatrix.Data there for is only available through that dll.
You can find WebMatrix.Data.dll in [Program Files Directory]\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\Assemblies or v2.0\Assemblies regarding the version you have installed.
I had the same error and I found this solution that worked for me:
http://www.w3schools.com/aspnet/webpages_database.asp
It seems that Webmatrix2 doesn't include the said .dll by default. I only had to download the nuget package from Webmatrix's gallery and it worked.
I hope it helps others.
My question is simple, I have two databases with the same scehema, one is live database say DLive and other one is testbed say DTestBed....
However, I want to use the same database namespace for both database. How can I achieve that without changing namespace in my code all over? Sometimes you need to do builds for live and testbeds in the same day ! Its really hard to change big project namespaces everytime you build.
How can I just change the webconfig connection string and get it done?
Thanks,
STEP 1:
Open 'Setting.ttinclude' from your Subsonic project..
STEP 2:
Add new vairable beneath 'const string DatabaseName'..
const string DatabaseObjectName = "DatabaseObjectName";// This is the object that you use for calling Stored Procedures, Tables and etc...
like this;
DatabaseObjectNameDB db = new DatabaseObjectNameDB();
STEP 3:
Now open 'ActiveRecord.tt', 'StoredProcedures.tt', 'Context.tt' files from your Subsonic project..
STEP 4:
Replace '<#=DatabaseName#>' with '<#=DatabaseObjectName#>' in above opened files...
STEP 5:
Now 'Run Custom Tools', by Righ-Click your Subsonic project...
Here you go...
Problem solved!!
Regards,
Naeem
Are you using SubSonic2 or three?
With SubSonic 3 it's as simple as this:
var db = new YourProductDB("connectionstringname");
var db = new YourProductDB("Server=localhost;Database=devdb;Uid=root;", "MySql.Data.MySqlClient");
for the first row you have to have both connection strings defined in your web.config/app.config