<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: Change subreport properties using .NET SDK in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/change-subreport-properties-using-net-sdk/qaa-p/14141845#M4918652</link>
    <description>I don't recall any actual stated inof not to use CR internal Parameter or use the same name. You will always see ?Pm- when a parameter is added. What is in your formula you are using? If the formula is invalid that could be why CR is deleting it, bad field name etc...</description>
    <pubDate>Tue, 01 Jul 2025 15:19:29 GMT</pubDate>
    <dc:creator>DonWilliams</dc:creator>
    <dc:date>2025-07-01T15:19:29Z</dc:date>
    <item>
      <title>Change  subreport properties using .NET SDK</title>
      <link>https://community.sap.com/t5/technology-q-a/change-subreport-properties-using-net-sdk/qaq-p/13690370</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;I'm using Crystal Reports SDK for semi-automated report customizing&amp;nbsp;and I am currently facing a very strange issue:&lt;/P&gt;&lt;P&gt;As soon as I change a property of a subreport (e.g. background color, position) Crystal Reports throws an InternalException "Invalid field name" for some reports when calling ReportDocument.Save or ReportDocument.Refresh.&amp;nbsp;Even if I start printing or preview after the change, I get the same error.&lt;/P&gt;&lt;P&gt;I created two almost identical reports (let's say testreport_01 and testreport_02) for testing. Both reports contain a subreport and a formula field that is linked to a parameter in the subreport.&lt;/P&gt;&lt;P&gt;The only difference: The parameter in testreport_01 was created manually before linking and in testreport_02 the parameter field was created automatically when the subreport link was created.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="HML_0-1714718483039.png"&gt;&lt;img src="https://community.sap.com/t5/image/serverpage/image-id/105356i6935AB1F4B15028E/image-size/medium?v=v2&amp;amp;px=400" alt="HML_0-1714718483039.png" title="HML_0-1714718483039.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="HML_1-1714718500689.png"&gt;&lt;img src="https://community.sap.com/t5/image/serverpage/image-id/105357iE7F392B7504AB4E8/image-size/medium?v=v2&amp;amp;px=400" alt="HML_1-1714718500689.png" title="HML_1-1714718500689.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;testreport_01.rpt passes the following test, testreport_02.rpt turns red.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;using CrystalDecisions.CrystalReports.Engine;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Drawing;

namespace ChangeSubreportTestProject
{
    [TestClass]
    public class ChangeSubreportTests
    {
        [TestMethod]
        [DataRow("./testdata/testreport_01.rpt")]
        [DataRow("./testdata/testreport_02.rpt")]
        public void TestChangeBackgroudColor(string filename)
        {
            var reportDocument = new ReportDocument();
            reportDocument.Load(filename);

            var reportObjects = reportDocument.ReportDefinition.ReportObjects;

            foreach (ReportObject reportObject in reportObjects)
            {
                if (reportObject is SubreportObject)
                    reportObject.Border.BackgroundColor = Color.Red;
            }

            reportDocument.SaveAs(filename + ".customized.rpt");

            reportDocument.Close();
            reportDocument.Dispose();
        }
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I also found out so far:&lt;BR /&gt;1. The problem does not occur if the check "Select data in subreport based on field" is set when linking.&lt;BR /&gt;2. If I catch the exception when saving and call ReportDocument.SaveAs again, the report is saved, but the parameter field has disappeared.&lt;/P&gt;&lt;P&gt;Is there any way to avoid this problem without manually replacing the parameter fields in the affected reports?&lt;BR /&gt;Or if not, how can I at least identify the affected parameters?&lt;/P&gt;&lt;P&gt;I'm using the latest runtime version 13.0.34 resp. 13.0.35&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2024 07:00:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/change-subreport-properties-using-net-sdk/qaq-p/13690370</guid>
      <dc:creator>HML</dc:creator>
      <dc:date>2024-05-03T07:00:47Z</dc:date>
    </item>
    <item>
      <title>Re: Change subreport properties using .NET SDK</title>
      <link>https://community.sap.com/t5/technology-q-a/change-subreport-properties-using-net-sdk/qaa-p/14140433#M4918485</link>
      <description>&lt;P&gt;Any subreport parameter beginning with ?PM- are internal objects for CR to use only. Don't play with them.&lt;/P&gt;&lt;P&gt;Create your own subreport parameter and use those for editing etc.&lt;/P&gt;&lt;P&gt;The error is due to the field linked no longer exists.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jun 2025 12:27:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/change-subreport-properties-using-net-sdk/qaa-p/14140433#M4918485</guid>
      <dc:creator>DonWilliams</dc:creator>
      <dc:date>2025-06-30T12:27:51Z</dc:date>
    </item>
    <item>
      <title>Re: Change subreport properties using .NET SDK</title>
      <link>https://community.sap.com/t5/technology-q-a/change-subreport-properties-using-net-sdk/qaa-p/14140460#M4918490</link>
      <description>Hello Don, for more than 25 years the names of all my parameters have started with Pm-. Is it documented somewhere that I am not allowed to name them like that? And I'm not playing around with the parameters here, in the example code I'm just changing the background color of the subreport. I suspect the problem is that the API does not change the properties of the existing subreport instance but creates a clone, deletes the original and reinserts the clone. This destroys the subreport links. Best regards HML</description>
      <pubDate>Mon, 30 Jun 2025 12:54:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/change-subreport-properties-using-net-sdk/qaa-p/14140460#M4918490</guid>
      <dc:creator>HML</dc:creator>
      <dc:date>2025-06-30T12:54:54Z</dc:date>
    </item>
    <item>
      <title>Re: Change subreport properties using .NET SDK</title>
      <link>https://community.sap.com/t5/technology-q-a/change-subreport-properties-using-net-sdk/qaa-p/14141845#M4918652</link>
      <description>I don't recall any actual stated inof not to use CR internal Parameter or use the same name. You will always see ?Pm- when a parameter is added. What is in your formula you are using? If the formula is invalid that could be why CR is deleting it, bad field name etc...</description>
      <pubDate>Tue, 01 Jul 2025 15:19:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/change-subreport-properties-using-net-sdk/qaa-p/14141845#M4918652</guid>
      <dc:creator>DonWilliams</dc:creator>
      <dc:date>2025-07-01T15:19:29Z</dc:date>
    </item>
  </channel>
</rss>

