Macro and function for publishing an analysis as a web page (AFAS Online)

AFAS supplies some functions and a macro for publishing an analysis. You download these from the AFAS site and include them in the analysis.

You publish the analysis on AFAS Online using a file location (web server) of AFAS Online. The file location contains a subfolder with the name of your environment (for example O12345AA). The 'PublishAnalysis' function publishes the cockpit in a separate subfolder with a name that is the same as the analysis name. We only mention this for informative purposes. In practice, you will not have to pay any attention to all of this.

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

    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.

Contents

Download the sample code and include it in the analysis

You add the sample code of the functions and a macro to the analysis.

To edit an analysis:

  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: Next.
  5. Click on: Finish.
  6. Start InSite.
  7. Click on: Communication Center.

  8. Open the analysis.

To download the sample code of module 1 and include it in the analysis:

  1. Go to the tab: ‘Image.
  2. Go to: 'Macros / ‘Display macros'.

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

  3. Enter a name.

  4. Click on: 'Maken'.

    The Excel macro editor is launched and you see the dummy code (Sub Dummy() ... End Sub).

  5. Select the dummy code and delete it.

  6. Download the sample code of module 1.
  7. Copy all of the code to the Clipboard.
  8. Paste the code in the macro. It automatically ends up in 'Module1'. If you already had modules, the code can be in a different module.

To download the sample code of module 2 and include it in the analysis:

  1. Right-click 'Modules'.
  2. Click on: 'Invoegen / Module'.

    A new module is added (in this example 'Module2').

  3. Download the sample code of module 2.
  4. Paste the code in the new module.

Adjust the sample code

You include the name of the worksheet to be published and the cell range in the macro.

Preparation:

  1. In Excel, open the worksheet that you want to publish as a cockpit.
  2. You need the name and the cell range to be published. In the example the name is 'MyCockpit'. The cell range starts at the upper left, for example in cell A1. The cell range extends to the cell at the bottom right, for example E60.

To adjust the sample code:

  1. Open the macro editor.
  2. Double-click on 'Module1' to open it.
  3. You can change the name of the output file (Cockpit.htm), but this is not mandatory. Users who view the cockpit via InSite do not see this name.

    'Main publication folder and HTM name

    strFileLocation = GetAfasPublishPath

    strFileName = "Cockpit.htm"

  4. You can adjust the height and width. Test to see if the set height and width work out well.

    strHeightInPixels = "1500px"

    strWidthInPixels = "990px"

  5. Enter the name of the worksheet and the cell range.

    'Name of the Excel worksheet you want to publish and the cell range on this worksheet

    'ACTION: Enter the name of the sheet to be published and the cell range

    strSheetName = "MyCockpit"

    strPublishArea = "$A$1:$E$60"

Activate Microsoft XML 4.0

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:

Test publishing a cockpit

If you want to test the macro manually, call the 'PublishAnalysisDirect()' macro.

Preparation:

  1. Open Windows Explorer on the machine on which you have the analysis opened.
  2. Check whether the following folder exists: C:\Temp.
    • If the folder does not yet exist, create it.
    • If the folder does exist, check that it is empty.

To test publishing:

  1. Go to the tab: ‘Image.
  2. Go to: 'Macros / ‘Display macros'.

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

  3. Select the 'PublishAnalysisDirect' macro.
  4. Click on: 'Uitvoeren'.

    The cockpit is published.

  5. Start Windows Explorer and open the following folder:

    C:\Temp

  6. Check the generated cockpit.

Directly to

  1. Publish a cockpit (analyses) on InSite (new method, AFAS Online)
  2. Add and activate a page type for cockpits
  3. Macro and function for publishing an analysis as a web page
  4. Schedule a cockpit for publication on InSite
  5. Include an analysis in the InSite menu
  6. Migrate analyses to cockpit pages