BusinessIntelligencePlus provides a procedure and an External Object with the necessary methods to upload the new data of the application to your cube. According to your business, you can define when this procedure is going to be executed in order to upload new data.
The procedure "BusinessIntelligencePlus<CUBE_NAME>UploadData" has sample code so you can follow it to load the data.
As you can see this procedure has the 'Call Protocol' property set to "Command line", so you can create a Windows Scheduled Task or script to update automatically the data of the application as often as needed.
The steps to update the data of your cubes are the following:
1 - Get your cube's data
Open your BusinessIntelligencePlus<CUBE_NAME>Data procedure and copy the data of your cube in the sample code. For example:
2 - Remove the current cube's data
Before updating new data, you may need to remove the current data from the cube. In order to do it, you can use the methods "EmptyCube" and "RemoveData" from the UtilsBusinessIntelligencePlus external object.
The method "EmptyCube" receives by parameter the desired cube's id and it removes all its data. The method "RemoveData" receives by parameter the desired cube's id and specific load that you want to remove.
3- Generate the CSV file
You should generate the CSV with your current data by running the BusinessIntelligencePlusCSV<CUBE_NAME>) procedure as follows:
4- Upload the CSV file to load the cube
Once the CSV file is generated, you should upload it to the cube, by using the "UploadData" method:
If the load is successful, this method returns an identification of the load, so you can store it and then remove that specific load using the RemoveData method (instead of removing all the cube´s data)
5- Run the procedure
You can run the "BusinessIntelligencePlusUploadData" from GeneXus's IDE by doing right-click over it --> Run.
If you want to run this procedure by command line, follow the instructions below:
Run "BusinessIntelligencePlusUploadData" by Command Line in Java
The .java abusinessintelligenceplusuploaddata.java will be generated in the web folder of your application
Some jars are needed to run the procedure, these jars are included as Files in the KB and they are automatically copied to the \web\drivers folder.
So, copy and paste the following jars from \web\drivers to the \web folder.
- These jars are included as files in the KB so they will be automatically included in the deploy of it (for example in the webapp Tomcat folder)
- They are automatically included in the Classpath of the Generator:
Build the "BusinessIntelligencePlusUploadData" procedure and replace the tag <NAME_KB> with the name (or Package Name) of your KB:
java -cp "java -cp "gxclassR.jar; gxcommon.jar; gxcryptocommon.jar;gxmail.jar;javapns.jar;gxsearch.jar;gxoffice.jar;
C:\Program Files\Apache Software Foundation\Tomcat 9.0\lib\servlet-api.jar;.\drivers\BIPlusUpload.jar;
To run the .java by Command Line, open a Command Prompt in the web folder of your application and copy the previous line:
Run "BusinessIntelligencePlusUploadData" by Command Line in C#
An executable file called abusinessintelligenceplusuploaddata.exe will be generated in the bin folder of your application.
Some dlls are needed to run the .exe. These dlls are included as Files in the KB. So, they are automatically included in the build process.
Build the "BusinessIntelligencePlusUploadData" procedure and execute in the Command Prompt the generated .exe located in the bin folder of your application:
6 - Automate the process.
You may need to automate the process and run the "BusinessIntelligencePlusUploadData" procedure periodically. There are many ways to do it.
You can see an example in the following link: Automate the data upload