Skip to Content
Author's profile photo Former Member

A script to get the number of reports and the name of them in a WEBI Document

Hi,

this blog post is about how to get the number and the names of reports in a document.

As this is a Javascript code, it will only work when viewing-editing the document in HTML mode.

The information about the reports can be found in webiViewFrame.DS.arrReports, the number of reports is given by webiViewFrame.DS.arrReports.length and the name of them is given, looping through arrReports

for (i=0;i<webiViewFrame.DS.arrReports.length-1;++i)

{ name = webiViewFrame.DS.arrReports[i].name }

To set the script, drop a blank cell over the report and set it’s text to

<script>

numberOfReports = webiViewFrame.DS.arrReports.length;

for(i = 0;i<numberOfReports-1;++i)

alert(webiViewFrame.DS.arrReports[i].name);

</script>

Set the property of the cell “Read As” to HTML.

Cheers,

Rogerio

Assigned Tags

      5 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Thanks for sharing Rogerio.

      I tried the above but didn't get the output,Cell with the script and HTML view remained as it is.

      Can you please explain the steps in little more detail.

      May be there is something that i m not doing correctly.

      Thanks,

      Sahil

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      Hi Sahil, thanks fpr your message. First of all , please check to see if your using the HTML client as using javascript only works with it.

      Second, can you please tell if an error is ocurring and whats its message.

      And finally, please paste the cells contentl,

      Regards,

      Rogerio

      Author's profile photo Former Member
      Former Member

      Thanks Rogerio.

      yes i am using infoview (HTML) and no error is coming, screen remain as it is.

      Cell content:

      <script>

      numberOfReports = webiViewFrame.DS.arrReports.length;

      for(i = 0;i<numberOfReports-1;++i)

      alert(webiViewFrame.DS.arrReports[i].name);

      </script>

      I am running a blank report based on xyz universe and pasted this cell in that blank report.

      Please let me know if anything else i need to do or am i missing something.

      Just want to update: I am using BOXI 3.1

      Thanks,

      Sahil

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      Hi Sahil,

      but did you change the preferences for WEB INTELLIGENCE at InfoView ?

      Second thing that comes to my mind is to ask if you´re Viewing or Modifying tyhe Document ? If you´re just Viewing, you have to add parent to webiViewFrame , like :

      parent.webiViewFrame.DS.arrReports.length

      Please let me know if you´re still experiencing some problem

      Author's profile photo Former Member
      Former Member

      Hi Rogerio,

      Yes, Preferences are fine in Infoview.
      Your another blog listed below is working fine on my machine.
      http://http://scn.sap.com/community/businessobjects-web-intelligence/blog/2015/01/05/how-to-set-a-webi-document-to-autorefresh-each-n-second

      I have tried in both mode( view as well as edit) but didn't get the output.

      Can you please share some screenshots inclusive of steps and the output, that will be more helpful.

      For Viewing the document i have added "parent.webiViewFrame.DS.arrReports.length"

      &
      For Editing, i have used the previous code i.e without using parent.

      Please see below screenshot, the blank cell remain blank after applied the code.

      SCN_SS.pngMany Thanks,

      Sahil Gupta