Creating a Repository Connection

To create a repository connection:

1. Make sure that all steps of the Creating the Web Application instruction are made.

2. On HTML page of the placed component, within the SCRIPT tag add a code that creates a repository connection and opens it:

var waiter = new PP.Ui.Waiter();//The Waiter component that is displayed during repository connection
metabase = new PP.Mb.Metabase({
      PPServiceUrl: "PPService.axd?action=proxy",//URL of web server request handler with specifying the Proxying operation
      Id: "PPRepository",//Identifier of the repository, to which connection is established
      UserCreds: {//User credentials to log in to repository
         UserName: "user",//Username
         Password: "password"//Password
      },
      //At the beginning of the request for repository connection display the Waiter component on the page
      StartRequest: function () {
         waiter.show();
      },
      //At the end of the request for repository connection hide the Waiter component 
      EndRequest: function () {
         waiter.hide();
         //At the end of request execution all requests are deleted from cache
         metabase.clearCache();
      },
      //In case of error a message with error text appears
      Error: function (sender, args) {
         alert(args.ResponseText);
      }
   });
metabase.open(); //open repository
	

3. Create a service for working with Foresight Analytics Platform tools. Services are implemented by the following classes:

Example of creating a service for working with express reports:

var eaxMbService = new PP.Exp.EaxMdService({

    Metabase: metabase

  });

4. Open a repository object for edit or view. In this case an object of one of the classes is created:

Example of opening an express report for edit:

var eaxAnalyzer = eaxMbService.editDocument(100);

100 - key of opened express report.

5. Then add code for placing the required component, see the DHTML Components section.

See also:

Example of Creating the WorkbookBox Component | Example of the ReportBox Component Layout | Example of Creating the ExpressBox Component | Example of the DimensionCombo Component Layout