microsoft / RdlMigration

Tool that converts RDL from a SQL Server Reporting Services Server or Power BI Report server and published to a Power BI premium workspace
MIT License
111 stars 44 forks source link

Migration Tool Creating Duplicate Data Sources During Conversion Process #55

Open biztalk2022 opened 2 years ago

biztalk2022 commented 2 years ago

I have tried running the migration tool on a report that contains 1 shared data source and 9 shared datasets. The original SSRS report runs fine in production. The output of the migration tool is a report that contains an embedded data source with the same name as the original shared data source, plus 9 additional data sources all with the same name - DataSource0_SQLSentry. Each data source seems to correspond with 1 of the 9 shared datasets pointing to the original shared data source. When the tool tries to upload the converted file, it obviously generates an error indicating that "Data source names must be unique within a report".

Has anyone encountered this issue?

duplicate_datasources error_message

biztalk2022 commented 2 years ago

After stepping through the code, I was able to see that the bug exists in the GetDataSourceReference function.

image

After already adding the one shared datasource to the reference list, it loops through all the datasets to find additional datasource references. These datasets all point to the 1 datasource that was already added but when the program does a comparison, it does not find the reference in the list.

image

In the screenshot below, the Dataset contains the same datasource reference as added to "retList" above, but the Name is different. So the program gives it a new name and adds it to the datasource list "retList". It does this for each dataset that is referencing the EXACT same datasource as found in retList[0]. These additional entries should not be created.

image

Please update the code to fix this bug. It exists in the latest version.

biztalk2022 commented 1 year ago

I downloaded the code committed/updated on 9/22/22 and ran it.

The updates to the code have fixed the "can't find corresponding dataset" issue (#57). THANK YOU

However, 2 issues remain:

  1. The program is unnecessarily creating a new data source that is a copy of the original data source that previously existed in the report. The only difference between the two is that the new data source has a different name with a GUID appended. It has the same connection details and reference info.
  2. The program is generating new data source references for each dataset but the data sources are not retained in the converted report. This is generating an error. In my report example, all 10 datasets point to the exact same data source, so it should not be generating multiple data source references with different names and GUIDs.

image image

XML from Converted File image

Areas of Concern Contributing to Issues: In ConvertFileWithDataset, why is it changing the dataSetSourceName and adding a GUID?
image

If it retains the original remoteDataSourceName without adding the GUID, there would be no issue. image

In GetDataSourceReference, it's checking for the existence of the entire dataSetSourceRef object…which will always be different b/c the names are different. Instead, it should be checking the actual dataSetSourceRef.Reference value. If it did the string value check instead of comparing the entire object, it would see that the datasource already exists in the list at Element(0).

image image

As an example, making a change similar to the change below (not sure of correct/best syntax but this code worked) would resolve the issue of it creating a secondary data source that is exactly the same as the first…only with a different name. image

Please update the code to resolve these issues.