Skip to main content

Embedded Reports and DataLayer links

Comments

7 comments

  • Martin Rees

    <?xml version="1.0" encoding="utf-8"?>
    <Report
    ID="ExampleEmbedReport"
    >
    <LocalData>
    <DataLayer
    ID="StaticDataLayer1"
    Type="Static"
    >
    <StaticDataRow
    Product="A"
    Sales="10"
    />
    <StaticDataRow
    Product="B"
    Sales="15"
    />
    <StaticDataRow
    Product="C"
    Sales="20"
    />
    <DataLayerLink
    ID="dlSalesData"
    />
    </DataLayer>
    </LocalData>
    <Body>
    <Gauge
    Caption="TotalSales"
    Type="Number"
    Value="@Data.sumOfSales~"
    >
    <DataLayer
    ID="dlTotalSales"
    LinkedDataLayerID="dlSalesData"
    Type="Linked"
    >
    <AggregateColumn
    AggregateColumn="Sales"
    AggregateFunction="Sum"
    DataType="Number"
    ID="sumOfSales"
    />
    </DataLayer>
    </Gauge>
    <ChartCanvas
    ID="ChartCanvas1"
    >
    <DataLayer
    ID="salesData"
    LinkedDataLayerID="dlSalesData"
    Type="Linked"
    />
    <Series
    ChartLabelColumn="Product"
    ChartYDataColumn="Sales"
    Type="Pie"
    />
    </ChartCanvas>
    <DataTable
    ID="dtTable"
    >
    <DataLayer
    ID="dlTableSales"
    LinkedDataLayerID="dlSalesData"
    Type="Linked"
    />
    <AutoColumns/>
    </DataTable>
    </Body>
    <ideTestParams/>
    </Report>
    0
  • Martin Rees
    <html>
    <head> </head>
    <body>
    <h2>The Application</h2>
    This is an example of embedding a Logi Report using JS
    <button onclick="CreateReport()">Load Report</button>
    <div id="reportContainer"/>

    <script type="text/Javascript">
    function CreateReport() {
    var options = {
    applicationUrl : "http://localhost/DemoApp/",
    report : "ExampleEmbedReport",
    autoSizing : "all",
    linkParams : { "ClientCodePath": "ba5ccdf2-f702-49c5-b3f0-9883a0a7bbc2"}
    };
    var report = EmbeddedReporting.create('reportContainer', options);
    }
    </script>
    <script src="http://localhost/DemoApp/rdTemplate/rdEmbedApi/rdEmbed.js" type="text/Javascript"></script>
    </body>
    </html>
    0
  • Glyn McKenna

    Hi Martin,

    Your example seems to be working okay for me? I would maybe look out for a CORS issue when using the API though. Just check the Network tab of the browser developer tools, when you try it you may need to reload the page to see the network traffic displayed fully. I think you should see your API request in there, so maybe check if it has errored and is highlighted in red

    0
  • Martin Rees

    Hi Glyn,

    Thank you for your response.  The issue I have isn't related to the API unfortunately.  The example I gave above (using a DataLayer.Static) does not work for me, you can see the errors for Gauge.Number and Chart.Canvas plus the successful DataTable at the end.  All are using the same DataLayer.Linked built from the DataLayer.Static.  I have had the same result when I have tried to use a .JSON text file as a datasource.

    The debug from the Gauge.Number element:

    I can see in rdDataCache the following files after I run the report from my HTML page:

    When I run it from my Logi App, which runs successfully -  get an extra file that seems to be the data source for the Chart Canvas:


    0
  • Glyn McKenna

    Hi Martin,

    There has been a few things I've seen in this area before, one was related to an issue with IIS on Windows Server 2012 R2 quite a few years back now, where it caused an app pool restart and the directory to be cleaned up when it saw high file i/o activity. I can see you're on Windows 10 as well as the fact you have other files in the directory so it's probably safe to say it's not that. The other reasons were related to session state being lost and sometimes permissions. 

    As you're running this in a local environment, are you able to try opening up permissions on the rdDataCache directory? 

    If you have no joy here, there is an alternate approach you could potentially use and that's to setup your data layers using a datalayer cache instead of the datalayer.linked. You would just need to refer to the same cache key on each visual, and depending on the currency of the data, this would have the added advantage of being available to all users and all reports that access the same cache key, so you could reduce database load even further. It does depend on how you can setup the cache timeout though, and may connections to constantly updating transactional databases may restrict your options.

    The last option will be to log a support ticket and someone from the support team maybe able to spend a bit more time helping to investigate the issue, or they may have an answer ready for you

    0
  • Martin Rees

    Hi Glyn,
    Thank you for this.  I tried opening up the rdDataCache directory to everyone, still no luck.  I'm not sure Cached data is the way to go for us - it would have to expire pretty much straight away due to the nature of the data.

    I will open a support call.

    Thanks

    Martin

    0
  • Glyn McKenna

    No problem, Martin sorry I wasn't able to help. Hopefully the Support team have the answers for

    Best regards
    Glyn

    0

Please sign in to leave a comment.