Frequently Asked Question

Automate the Need4Viz HTML export / Use N4V Variables to generate dynamics path and filename
Dernière mise à jour il y a un an

Symptom

  • Use Need4Viz Variables (like SAPBI Placeholders) to generate dynamic Folder Path and filenames 
  • Create a Publication in order to generate all the HTML files

Environment

  • Windows Server
  • Need4Viz : all versions

Resolution

To configure Need4Viz services to enable HTML Export :

To configure a Need4Viz component to be exported as HTML in folder destination (HTML Export OR FTP is configured for Need4Viz services):

  1. In a Webi report, configure a new Need4Viz chart
  2. Validate the chart
  3. Add Webi Sections in order to generate as much HTML exports as you have of possible combinations (ie: if you have a dataset with 5 "year" and 3 "country"; you must generate 3*5 => 15 HTML exports). Here we created two sections, the first (1) on object [v_Year] and the second (2) on object [state_po]
image
  1. Open the Format Custom Element window of the chart and go to the Export HTML OR Export FTP (1) section depending on what type of destination you chose
  2. Tick the Automatically export the chart (2) (to enable the export for this chart)
  3. Fill the Path destination (3) : path of the destination folder. If the folder is set locally (For example C:/temp) it refers to the folder on the Need4Viz server (not on the user computer). If the folder does not exist, it is created (in lower case). The folder can be a shared or NAS folder (for example \\my_server\my_folder\%DR%EN%MMMMYYYY% that will write into the folder \\my_server\my_folder\november2020\).
  4. You can find the information about the available variables here 
  5. Fill the Name of the generated target HTML file (4) : name of the exported HTML file in the destination folder (for example : %SECTION%1%_%SECTION%2%.html) . If value of %SECTION%1% is 2016 and value of %SECTION%2% is AL , the HTML file will be 2016_al.html 
image
  1. Validate the settings
  2. Check in the destination folder, the file is created. if you browse the report, it will generate one HTML file per chart. If you browse the whole document, it will create all the HTML exports. 
image

Automate the export with a publication

  1. Create a new SAP BI publication (We don't want to use the publication to burst the report BUT only for the MHTML export format)
  2. In "Source document", add the webi report that you just set for the Need4Viz HTML export
  3. In "Enterprise Recipient", select any user
  4. In "Format":
    1. In "Output Format", select mHTML
    2. In "Output Format Details", select the report on which you set the Need4Viz HTML export
  5. "Prompts" (Optionally), fill the prompts
  6. Click OK
  7. The new publication appears in the list
  8. Right click on it and select Schedule
  9. Select "Run Now", wait that scheduling is in success and check that the files are generated in the folder you set in the Need4Viz component (\\my_server\my_folder\november2020 in this example)

Normalization of filename and path

The following formulas are applied to normalize the filename and path of the exported HTML file. 

FileNameHTML.normalize("NFD").replace(/[\u0300-\u036f]/g, ""); 

FileNameHTML.replace(/[^a-z0-9_\-\.]/gi, '_').toLowerCase();

Possible issue

In case of file not created in the destination folder, check :

  1. The destination folder does not need an authentication (this is not supported)
  2. If the destination folder does not exist, try to export in an existing folder.
  3. Numeric sections are not supported for now- please use a variable to transform the numeric value to text value

To get more informations about the issue :

  1. Enable Debug mode in Need4Viz config.js file (set LogDebug parameter to true)
  2. Restart Need4Viz services
  3. Test again an HTML Export of your chart
  4. Open the~Need4Viz_folder_installation/log
  5. check the n4v_xxx_out.log and n4v_xxx_err.log file (where xxx is the service that should render the charts)

Veuillez patienter!

S'il vous plaît patienter... il faudra une seconde !