Difference between revisions of "Automate Update data/en"

From TaticView
Jump to: navigation, search
(Importing a new version from external source)
(Importing a new version from external source)
Line 7: Line 7:
 
-->
 
-->
  
You can automate the data update of your Data Files.
+
With TaticView, you can automate the update of your [[Data_Sources|Data Files]].
  
 
Some setup procedures and the use of [[TVCli]] command line program are necessary to automate updates on TavicView.
 
Some setup procedures and the use of [[TVCli]] command line program are necessary to automate updates on TavicView.

Revision as of 04:15, 8 March 2018

Other languages:


With TaticView, you can automate the update of your Data Files.

Some setup procedures and the use of TVCli command line program are necessary to automate updates on TavicView.

If you are having trouble, open a support ticket on https://support.taticview.com/open.php. We are glad to help you.


Important: TVCli works with java from version 7.0_80. However, we recommend using Java 8 because Java 7 is discontinued by Oracle.


Installing TVCli

First download the installer:


Then run the installation on the same workstation where the files that are going to be automatically imported are.


Access TOKEN generation

You must have an Access TOKEN registered on TaticView and TVCli before you can run an automation import. An Access TOKEN is always related with a TaticView user. The Access TOKEN is like a password generated by TaticView which allows access to your account through TVCli. It can be revoked by you at any time, allowing you to decide who and when can access your account on TaticView.

An Access TOKEN is always linked to a TaticViwe user. The TOKEN works like a TaticView generated password that allows access to TVCli. The TOKEN can be revoked at any moment, allowing you to decide who can access your TaticView account and when. It is important to remember that this access only allows the update of data files that are set to be automatically updated.


You can generate the Access TOKEN in two ways:


Through TVCli

  1. Run the command through command line requesting the generation of a new Access TOKEN.


Syntax: tvcli -cmd get_token_by_password -user <user name> -password <user password> [-token_name "<token name>"]

 -cmd                   - get_token_by_password - Requests and stores the ACCESS TOKEN through command line. (TVCli)
 -user                  - TaticView user
 -password              - TaticView password
 -token_name (optional) - The name that you want to give to the access token. Default name "TaticView CLI"         

Example:

 tvcli -cmd get_token_by_password -user myemail@email.com -password 123466 -token_name "TVCli Server 1" 


Through TacticView interface

  1. Identify yourself on TaticView and access the My account button Access TOKENS;
  2. On Identificacao-novo-token+en-US.png enter a name to identify the Access TOKEN on the list and then click on Generate new TOKEN.
  3. An Access TOKEN will be generated Generated-token+en-US.png
  4. Run TVcli informing the generated Access TOKEN


Syntax: tvcli -cmd store_token -user <user name> -token <generated token>

 -cmd   - store_token - stores token generated through the interface
 -user  - TaticView user 
 -token - The token generated through the interface

Example:

 tvcli -cmd store_token -user meuemail@email.com -token 9bdr845gh5r4r1vd5d5


Updating in an automated way

You can only automate the update of data sources that have been already created on TaticView, so you are going to need at least one manual import to create the necessary structure. Then you must grant the automatic import to the desired data file. To do this click on the imported file (On the TaticView interface), select Properties, and check the checkbox Automatic Importation, which displays the identifier code of your data file, as you can see in the example below:

After that, it will be necessary to enable the automatic update to the desired data file. To do so, access the TaticView main page, click on data files, select Settings, and enable the Automatic Update option. After that, it will display the data files code on the screen. See the example below:

Datamart-dropdown+en-US.png


File:Automatic-importation+en-US.png


Once the data file is imported, granted for automatic import and you have your identification code, you can run the import through the command line.


Command Syntax: tvcli -cmd import_file -user <your TaticView user> -datamart -file "<file/spreadsheet address>" [-type "<type>"] [-wait [-notifyshare]] [-nonotifyerror]


 -cmd                   - import_file   - uploads the data file and places it in the import queue
 -user                  - TaticView user 
 -datamart              - identifier of the data file obtained in the Data file properties at the interface.
 -file                  - Text data file (CSV) or spreadsheet (XLSX,XLS) to be imported.
 -type (opcional)       - clear_and_add - Deletes all data from TaticView Data File and imports the new data. (default)
                          append        - Adds the new data at the end of the TaticView Data File. It is necessary to be careful not to duplicate any data.
 -wait (opcional)       - waits for the end of the import.  It is needed to test Output Status
 -nonotifyerror (opcional)    - does not notify the user if an error occurs during the process
 -notifyshare (opcional) - sends data update notification to users who have these data file dashboards shared when the importing process ends without errors. Only works with -wait. 

Example:

 tvcli -cmd import_file -user myemail@email.com -datamart 246 -file "c:\taticview\imp\spreadsheet.xlsx"
 tvcli -cmd import_file -user myemail@email.com -datamart 246 -file "c:\taticview\imp\file.csv" -wait -notifyshare
 tvcli -cmd import_file -user myemail@email.com -datamart 246 -file "c:\taticview\imp\spreadsheet.xlsx" -wait
 tvcli -cmd import_file -user myemail@email.com -datamart 246 -file "c:\taticview\imp\spreadsheet.xlsx" -type clear_and_add
 tvcli -cmd import_file -user myemail@email.com -datamart 246 -file "c:\taticview\imp\spreadsheet.xlsx" -type append
 tvcli -cmd import_file -user myemail@email.com -datamart 246 -file "c:\taticview\imp\spreadsheet.xlsx" -type append -nonotifyerror


TVCli version

Shows TVCli version on console and register into log file.


Command Syntax: tvcli -version


Command return test

The TVCli executable returns different codes to report the success or failure during the execution process.

 0 - Success
 8 - Error

A notification is sent to the user if an error occurs during the import process. A log with the details of the executions will be generated in the configuration directory of the user (example: C:\Users\<user>\AppData\Local\TVcli\Logs).


Questions on how generate the automation commands?

Open a support ticket. In case you are having problems during the TVCli configuration process. It will be a pleasure to help.

Also, on the Data Files properties screen, when clicking the link help to generate automation commands?, it will display the TVCli Generate Commands screen, where you can obtain preset TVCli commands. All you have to do is inform some required data.


Script example

@ECHO OFF
call tvcli -cmd import_file -user jonathan@sadig.com -file "C:\Users\jonathan.SADIG\Documents\TaticView\Import Files\sales.xlsx" -datamart 674 -wait
if %errorlevel% == 0 (
	echo "SALES updated successfully!"
) else (
	echo "Problems updating SALES!"
)
call tvcli -cmd import_file -user jonathan@sadig.com -file "C:\Users\jonathan.Sadig\Documents\TaticView\Import Files\hr.xlsx" -datamart 673 -wait
if %errorlevel% == 0 (
  	echo "HR updated successfully!"
) else (
  	echo "Problems updating HR!"
)