Adjust an analysis for publication on InSite (local installation)

You include the 'PublishAnalysis' macro in the analysis. When you publish the analysis, the macro is called to generate the web files. If you use the Command Line Utility to publish the analysis, the 'PublishAnalysis' macro is called and the macro is published as a web page.

One of the functions (GenerateXMLforInSite) generates an XML file. The XML file is used for calling the analysis. Depending on the type of site, the XML file has one of following regular names:

  • insite.xml
  • outsite.xml

You also have to add this folder on your system.

Add a macro and a function to the analysis

Note:

For the Social analysis (Profit), you do not perform this step. To record settings, you follow a separate procedure. You therefore do not adjust the 'PublishAnalysis' macro.

If you want to publish an analysis automatically, it should contain both the 'PublishAnalysis' macro and the 'GenerateXMLForInsite' function.

If you were already publishing analyses in previous Builds of Profit, these analyses already contain the 'PublishAnalysis' macro. Amongst other things, this macro determines which Excel worksheet is published. You adjust this macro and add the 'GenerateXMLForInsite' function.Every analysis is published in a separate folder. You record this folder in the 'PublishAnalysis' macro. The name of the folder must be the same as the name of the analysis in Profit.

In the procedure below, it is assumed that you adjust an existing macro. However, you can also download sample code.

To change the 'PublishAnalysis' macro and add the 'GenerateXMLForInsite' function:

  1. Go to: Profit Windows.
  2. Go to:
    • General / Output / Management / Analysis (all analyses)
    • CRM / Output / Management / Analysis
    • Financial / Output / Management / Analysis
    • Fiscal / Output / Management / Analysis
    • HR / Output / Management / HRM analysis
    • HR / Output / Management / Payroll analysis
    • Order Management / Output / Management / Analysis
  3. Double-click on the analysis.
  4. Click on: Design.

    The analysis is opened in Microsoft Excel.

  5. Go to the tab: ‘Image.
  6. Go to: 'Macros / ‘Display macros'.

    App_Analyse aanpassen voor publicatie InSite (vanaf Build 2) - msxml 3

  7.  Select the 'PublishAnalysis' macro.
  8. Click on 'Edit'.

    App_Analyse aanpassen voor publicatie InSite (vanaf Build 2) - msxml 3

    The macro editor is started and the old macro is shown.

    App_Analyse aanpassen voor publicatie InSite (vanaf Build 2) - msxml 3

    You are now going to change the macro.

  9. Copy the following code to the Clipboard:

    Dim strFilePath As String

    Dim strFileName As String

    Dim strFileLocation As String

    Dim strNameWorkbook As String

    Dim strHeightInPixels As String

    Dim strWidthInPixels As String

    'Main folder and HTM name

    strFileLocation = "C:\Localfolder\Environment\"

    strFileName = "Cockpit.htm"

    'Determine the analysis name

    If Right(Application.ActiveWorkbook.Name, 4) = ".xls" Then

    strNameWorkbook = Left(Application.ActiveWorkbook.Name, Len(Application.ActiveWorkbook.Name) - 4)

    Else

    strNameWorkbook = Left(Application.ActiveWorkbook.Name, Len(Application.ActiveWorkbook.Name) - 5)

    End If

    strHeightInPixels = "1500px"

    strWidthInPixels = "990px"

    If Right(strFileLocation, 1) = "\" Then

    strFilePath = strFileLocation & strNameWorkbook & "\"

    Else

    strFilePath = strFileLocation & "\" & strNameWorkbook & "\"

    End If

    'Add publication folder if it does not exist.

    If Dir(strFilePath, vbDirectory) = "" Then

    MkDir strFilePath

    End If

  10. Paste the code in the macro, under 'Sub PublishAnalysis'.

    App_Analyse aanpassen voor publicatie InSite (10 proc analyse aanpassen) - pad

  11. You change the main folder for the analysis.

    The sample code includes the line:

    strFileLocation = "C:\Localfolder\Environment"

    Suppose you want to publish to 'C:\Cockpits' and the environment is 'EnYoi'. In that case the folder is:

    strFileLocation = "C:\Cockpits\EnYoi"

  12. The code from the old macro also contains a file location (the publication folder and the HTM name of the cockpit page).

    New path: 'LocalServer\cockpits\ + environment name + analysis name + pagename.htm

    Example:

    Environment name: ENYOI

    Main folder for this environment:C:\Cockpits\EnYoi\

    Name of an analysis to be published: Managementinfo

    Publication folder of the cockpit: C:\Cockpits\EnYoi\Managementinfo

    Complete file path:

    C:\Cockpits\EnYoi\ + managementinfo (=analysis name) + cockpit.htm (=page name)

    Result:

    C:\Cockpits\EnYoi\managementinfo\cockpit.htm

  13. Copy the following code to the Clipboard:

    GenerateXMLForInsite strHeightInPixels, strWidthInPixels, strFilePath, strFileName

  14. Paste the code in the macro , above 'End Sub'.

    App_Analyse aanpassen voor publicatie InSite (vanaf Build 2) - msxml 3

  15. Open the file with the sample code of the functions.
  16. Copy the complete sample code of the function.
  17. Paste the sample code in the window, under the macro.

    App_Analyse aanpassen voor publicatie InSite (vanaf Build 2) - msxml 3

Activate Microsoft XML

This Microsoft XML version is present if you have installed Profit. If not, use the 'Aanvullende bestanden' option to download 'MSXML (Microsoft XML Core Services)' from the AFAS Customer portal.

To activate Microsoft XML:

  1. In the Excel macro editor, go to 'Tools / References'.
  2. Select the 'Microsoft XML v4.0' check box.

    App_Analyse aanpassen voor publicatie InSite (vanaf Build 2) - msxml 3

  3. Click on: OK.

See also:

Directly to

  1. Publish a cockpit on InSite (local installation)
  2. Install and configure the Profit Communication Center (PCC)
  3. Install Microsoft Excel
  4. Add a publication folder per cockpit
  5. Set the main folder for cockpits in the DAppSets file
  6. Add and activate a page type for cockpits
  7. Modify an analysis for publication on InSite
  8. Include an analysis in the InSite menu
  9. Schedule a cockpit for publication on InSite (Local installation)