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 122: Line 122:
 
=== Commands response test ===
 
=== Commands response test ===
  
The TVCli executable returns different codes to report the success or failure during the execution process.
+
TVCli executable returns specific codes to inform the success or failure of its commands. Currently, the available codes are:
  
 
   '''0 - Success'''
 
   '''0 - Success'''

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   - Command that uploads your files and add them to the update queue.
 -user                  - Your TaticView user (access e-mail).
 -datamart              - The identification code of the data file obtained through the properties option on the TaticView main page.
 -file                  - The address of the text (CSV) or spreadsheet (XLSX, XLS, XLSM) data file that will be updated. You can use mapped drives (Ex.: C:\, D:\) or UNC address (Ex.: \\server\folder\file).
 -type (opcional)       - clear_and_add - Deletes every data from the TaticView's Data File and imports new data. This is TVCli's default behavior.
                          append        - It adds new data to your TaticView's data files file/spreadsheet while still keeping the previously imported data. It's important to make sure to not duplicate any data.
 -wait (opcional)       - Command that makes TVCli wait the end of your data updates along with TaticView. It's necessary in case you want to test commands responses (ERROR_LEVEL).
 -nonotifyerror (opcional)    - Command used to not notify the user in case of an error occurring during the update process. 
 -notifyshare (opcional) - Command used to send a notification to the users who own shared dashboards informing that the data update finished successfully. This command only works when used with the -wait command. 

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


Commands response test

TVCli executable returns specific codes to inform the success or failure of its commands. Currently, the available codes are:

 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!"
)