Forum Discussion

Clampazzo's avatar
Clampazzo
Icon for Resolver I rankResolver I
2 years ago
Solved

is it normal for when I run Embedded export to pdf it resets embedded report

I am setting up an apps own data embedded export to pdf using ExportToFileInGroup and then polling to see if the file is available and of course download the file. 

 

However, I noticed when stepping through the code when I run the above steps (it doesn't appear to be consistent but always happens between the above 2) my embedded report resets.  What I mean by that is I navigate to the embedded report, select the one I want, hit Export to PDF and then the report goes away to default from when i arrive at our site.  Sometimes it exports and sometimes it doesn't.  


I can't seem to find any error messages when it does this.  I've turned on try and catch but no error messages.  

 

 

     var powerBIReportExportConfiguration = new PowerBIReportExportConfiguration
     {

         Identities = new List<EffectiveIdentity>
         {
             new EffectiveIdentity
             {
                 Username = userName.ToString(),
                 Roles =new List<string> { "RLS" },
                 Datasets = new List<string> { DATSETID }
             }
 },
         Settings = new ExportReportSettings
         {
             Locale = "en-us"
           
         },
 


     };

     var exportRequest = new ExportReportRequest
     {
         Format = format,
         PowerBIReportConfiguration = powerBIReportExportConfiguration
     };
     if (ExportFilter != "")
     {
         exportRequest.PowerBIReportConfiguration.ReportLevelFilters =
           new List<ExportFilter>() {
     new ExportFilter { Filter = ExportFilter }
           };
     }
     

     try
     {
      
         var export =  client.Reports.ExportToFileInGroup(groupId, reportId, exportRequest);

         string exportId = export.Id.ToString();

 

  • Resolved it... the issue was in the javascript code that called the c# code.  I removed this at the end:  location.reload();.  

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Clampazzo ,

    Can you please share some more detail information about this issue? They should help us clarify your scenario and test to troubleshoot.

    How to Get Your Question Answered Quickly  

    In addition, any reload/refresh events are you triggered? They may reset the stored variables and effect the export function usages.

    Regards,

    Xiaoxin Sheng

    • Clampazzo's avatar
      Clampazzo
      Icon for Resolver I rankResolver I

      Let me know if this helps.  
      I load my report in embedded so it can be seen IE below

      Then I click on my new "Export to PDF" Button which executes the code above.  When it gets to the step(s) 

      ExportToFileInGroup

      or

      GetExportToFileStatusInGroup

       

      the embedded report 'resets' and basically goes back to what it looks like before I select a report.

       

      The export works but if I wanted to continue working int hat report I'd have to load it again.

       

       

      • Clampazzo's avatar
        Clampazzo
        Icon for Resolver I rankResolver I

        Resolved it... the issue was in the javascript code that called the c# code.  I removed this at the end:  location.reload();.