Automação da Atualização dos dados

From TaticView
Revision as of 18:56, 22 September 2017 by Jonathan (talk | contribs)
Jump to: navigation, search
Other languages:
English • ‎português do Brasil


Automação de atualizações de dados no TaticView

Você pode através desse processo automatizar as atualizações das informações dos seus Arquivos de Dados.

Para automatizar as atualizações de dados no TaticView são necessários alguns procedimentos de configuração e uso do programa de linha de comando TVCli.

Caso tenha dificuldades abra um ticket de suporte em https://support.taticview.com/open.php/?&lang=pt_br. Teremos prazer em lhe ajudar.

Instalando o TVCli

Primeiramente baixe o instalador:

Depois execute a instalação na mesma máquina onde estarão os arquivos que serão usados para as atualizações automáticas.

Geração do TOKEN DE ACESSO

É necessário possuir um TOKEN DE ACESSO cadastrado no TaticView e no TVCli antes de poder executar uma automação de atualização. Um TOKEN DE ACESSO está sempre associado a um usuário TaticView. O TOKEN DE ACESSO é como uma senha gerada pelo TaticView que permite acesso a sua conta pelo TVCli, ele pode ser revogado por você a qualquer momento, permitindo assim que você decida quem pode acessar sua conta no TaticView e quando.

É possível gerar o TOKEN DE ACESSO de duas maneiras:


Pelo TVCli

  1. Executar o comando via linha de comando pedindo geração de um novo TOKEN DE ACESSO
   Sintaxe: tvcli -cmd get_token_by_password -user <usuário> -password <senha> [-token_name "<nome do token>"]
 -cmd                   - get_token_by_password - Solicita e armazena o TOKEN DE ACESSO via linha de comando (TVCli)
 -user                  - usuário TaticView 
 -password              - senha TaticView
 -token_name (opcional) - Nome que você quer dar ao TOKEN DE ACESSO. Nome default "TaticView CLI"          
   Exemplo: tvcli -cmd get_token_by_password -user meuemail@email.com -password 123466 -token_name "TVCli Servidor 1"


Via interface do TaticView

  1. Identificar-se no TaticView e acessar o Minha Conta botão TOKENS DE ACESSO;
  2. Em Identificacao-novo-token+pr-BR.png informe um nome para identificar o TOKEN DE ACESSO na lista e clique em Gerar novo TOKEN.
  3. Um TOKEN DE ACESSO será gerado Generated-token+pr-BR.png
  4. Executar o TVCli informando o TOKEN DE ACESSO gerado
   Sintaxe: tvcli -cmd store_token -user <usuário> -token <token gerado>
 -cmd   - store_token - armazena token gerado pela interface
 -user  - usuário TaticView 
 -token - token gerado pela interface
   Exemplo: tvcli -cmd store_token -user meuemail@email.com -token 9bdr845gh5r4r1vd5d5


Atualizando de forma automatizada

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:

Datamart-dropdown+en-US.png


File:Automatic-importation+en-US.png

Estando o arquivo de dados previamente importado, liberado para atualização automática e você possuir o seu código identificador, será possível executar a importação por linha de comando.

 Syntax: tvcli -cmd import_file -user <user name> -datamart <identifier> -file "<file/spreadsheet>" [-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


Versão TVCli

Mostra a versão do TVCli na console e registra na log.

   Sintaxe: tvcli -version


Teste de retorno do comando

O executável do TVCli retorna códigos distintos para informar o sucesso ou falha na execução.

 0 - Sucesso
 8 - Erro

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).


Exemplo de Script

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


Importante

The free version grants you automation import from only one data source. You need to configure the feature automatic data update in your subscription to automate the imports of more data sources.