Open main menu

TaticView β

Changes

Automate Update data

5,934 bytes added, 13:26, 15 April 2023
no edit summary
<languages/>
 
<translate>
<!--T:139--><div style="float: right;">__TOC__</div> <!--== '''Data Import update automation on TaticView''' ==<!--T:1-->--> <!--T:2-->With TaticView, you can automate the update of your [[Data_Sources|Data Files]]. <!--T:3-->To do so, it is necessary to adjust the settings and to use the command line program [[TVCli]]. <!--T:4-->See below the required steps to automate the data updates.  <!--T:38--><span style="color: red;">'''Important:'''</span> * To use TVCli, the computer where it will be configured must have java from version <i>8</i> installed. If you use a Java minor version the message "Unsupported major.minor version 52.0" will be showed, see [[Java JRE install and troubleshooting]] for help.* A notification will be displayed to the user if an error occurred during the data update.* A log with the execution details will be generated in the user's settings folder (Example: <i>C:\Users\<user>\AppData\Local\TVCli\Logs</i>).  === Installing TVCli === <!--T:5--> <!--T:65-->For now, we have only a user friendly installer for Windows. If you need install TVCli in other platforms, please contact us at <u>[https://support.taticview.com Support]</u>. We are glad to to help you to install it in you environment. <!--T:6-->* '''Download the [[TVCli Download|latest version]]  <!--T:51-->The browser can try to block the installer download. If you can't download please enter in contact with our support.Windows can too block the installer execution to protect the computer. In this case continue the installation choosing the advanced options. In both situations if you need contact us to help you.  <!--T:7-->* '''Run the installation''' on the computer where the schedules will be created to run the TVCli.  <!--T:59-->TVCli works through command line. The best way to automate the execution is creating a script, after that, you can schedule it to run on the system task scheduler.<br/>To install and execute TVCli on you computer we need Java JRE version 1.8.0_200 or newer installed.<br/>On [[Java JRE install and troubleshooting]] we can help you in case of doubts. === Generating the Access TOKEN === <!--T:8--> <!--T:9-->To automate the data updates through TCVli, it is necessary to own an '''[[Manage_Access#Tokens|Access TOKEN]]''' created on TaticView and then register it on TVCli. <!--T:40-->An Access TOKEN is always linked to a TaticView user. The TOKEN works like a TaticView generated password that allows access to TVCli. The TOKEN '''[[Manage_Access#Tokens|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.  <!--T:60-->Here we will show you how to generate a token whit TaticView interface.  <!--T:10-->There are two ways to generate an Access TOKEN: <!--T:61-->The main difference between them, besides the way they are generated, is that [[#Using_TVCli_command_line|command line]] selves, while the created by [[#Using_TaticView's_graphical_interface|TaticView interface]] don't refresh them selves (expire), and need to be recreated.   ====Using TVCli command line==== <!--T:11-->Run the command through a command line requesting the generation of an [[Manage_Access#Tokens|Access TOKEN]].
You can automate the data import of your Data Files.<!--T:62-->To help you on this, we wave a [[TVCli Commands|Wizard]]
Some setup procedures and the use of TVcli command line program are necessary to automate imports on TavicView.
If you are having trouble, open a support ticket on https<!--T://support.taticview.com/open.php. We are glad to help you.12-->Command Syntax: '''tvcli -cmd get_token_by_password -user <your TaticView user> -password <your TaticView password> [-token_name "<token name>"]'''
=== Installing TVcli === <!--T:13-->-cmd - get_token_by_password - The command responsible for requesting and storing the Access TOKEN on the TVCli settings. -user - Your TaticView user (access email). -password - Your TaticView access password. -token_name (optional) - The name you want to set to your Access TOKEN. The default name '''TaticView CLI''' will be set if you do not specify a name.
<!--T:14-->
Example:
'''tvcli -cmd get_token_by_password -user myemail@email.com -password 123466 -token_name "TVCli Server 1" '''
First download the installer====Using TaticView's graphical interface==== <!--T:* +Windows+* +Linux+* +Mac15--OS+>
Then run the installation on the same workstation where the files that are going <!--T:63-->Here we will show you how to be automatically imported aregenerate a token whit TaticView interface.
<!--T:64-->
# On the TaticiView [[Main Page Overview|home screen]], select [[User profile|My Acount]] and click on the [[Tokens|Access TOKENS]] button;
# On [[File:identificacao-novo-token+en-US.png]] inform a name to identify your Access TOKEN on the list and select '''Generate new TOKEN''';
# A new Access TOKEN will be generated [[File:generated-token+en-US.png]]
# Run the TVCli TOKEN storing command (<i>store_token</i>), informing the last generated TOKEN;
=== ACCESS TOKEN generation ===
You must have an <!--T:16-->Command Syntax: '''ACCESS TOKEN''' registered on TaticView and TVcli before you can run an automation import. An ACCESS TOKEN is always related with a tvcli -cmd store_token -user <your TaticView user. The ACCESS TOKEN is like a password > -token <the token 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. >'''
You can generate <!--T:17-->-cmd - store_token - The command responsible for storing the ACCESS TOKEN in two ways:TOKENS generated on TaticView. -user - Your TaticView user (access email). -token - The token generated on TaticView.
<!--T:18-->
Example:
'''tvcli -cmd store_token -user meuemail@email.com -token 9bdr845gh5r4r1vd5d5'''
'''Through TVcli'''# Run the command through command line requesting the generation of a new ACCESS TOKEN.=== Updating your data automatically === <!--T:19-->
'''Syntax: tvcli <!-cmd get_token_by_password -user <user name> T:20-password <user password> [-token_name "<token name>"]'''You can only automate the update of files that exist on TaticView. It will be necessary to import your file/spreadsheet manually for the first time to generate the required structure.
<!-cmd - get_token_by_password T:41- Requests and stores the ACCESS TOKEN through command line. (TVcli) -user - TaticView user -password - TaticView password> -token_name (optional) - The name After that you want , it will be necessary to give enable the automatic update to the desired data file. For this you must access tokenthe properties of the desired ''Datasource''. Default name "Access is available in the context menu of the Datasource card in the [[Main Page Overview|TaticView CLI" main page]]:
'''Example<!--T: tvcli 45-->{| class="images-table"| On desktop|-cmd get_token_by_password |[[File:Datasources properties en-user myemail@emailUS.com png|link=]]|-| In mobile devices|-|[[File:Datasources options mobile en-password 123466 US.png|link=]] [[File:Datasources properties mobile en-token_name "TVcli Server 1"'''US.png|link=]]|}
'''Through TacticView interface'''
# Identify yourself on TaticView and access the '''My account''' button '''ACCESS TOKENS''';
# On !identificacao-novo-token.png! enter a name to identify the ACCESS TOKEN on the list and then click on '''Generate new TOKEN'''.
# An ACCESS TOKEN will be generated !generated-token.png!
# Run TVcli informing the generated ACCESS TOKEN
'''Syntax<!--T: tvcli 46-cmd store_token -user <user name> -token <generated token>Then, the ''Automatic importation''option should be enabled. When you do this, you will see the data file code, as in the example below:
-cmd - store_token - stores token generated through the interface
-user - TaticView user
-token - The token generated through the interface
'''Example<!--T:22-->[[File: tvcli automatic-cmd store_token importation+en-user meuemail@emailUS.com -token 9bdr845gh5r4r1vd5d5'''PNG]]
=== Importing in an automated way ===<!--T:23-->You can execute the data import automatically using the identifier code through command line if the data file has permission to be updated automatically.
You can only automate the import of data files 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:
<!--T:24-->Command Syntax: '''tvcli -cmd import_file -user <your TaticView user> -datamart< data file identification code> -file "<file/spreadsheet address>" [-type "<type>"] [-wait [-dropdown.png!notifyshare]] [-nonotifyerror] '''
<!--T:25-->
-cmd - import_file - Command that uploads your files and add them to the update queue.
-user - Your TaticView user (access email).
-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 <i>-wait</i> command.
<!--T:26-->
Example:
'''tvcli -cmd import_file -user myemail@email.com -datamart 246 -file "\\servidor\taticview\imp\myspreadsheet.xls" '''
'''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'''
'''Call "C:\Program Files\TvCli\tvcli" -cmd import_file -user myemail@email.com -datamart 246 -file "D:\taticview\imp\spreadsheet.xlsx" -wait'''
=== Running TVCli from BAT (Script) file === <!automatic-importation.png!.-T:52-->
Once <!--T:53-->You can create BAT files to schedule a bunch of TVCli commands. Doing so the data file is imported, granted for automatic import and you have your identification code, entire process can be automated. As you can run the import through the command lineschedule using Windows scheduler or other similar tool.
'''Syntax: tvcli -cmd import_file -user <user name> -datamart <identifier> -file "<file/spreadsheet>" [-type <type>] [-wait] [-noerror] -[notifyshare]'''
<!-cmd - import_file - uploads the data file and places it in the import queue T:54-user - TaticView user > -datamart - identifier of the data file obtained in the Data file properties at the interface.'''''Attention'''''<br> -To execute TVCli from a BAT file - Text data file (CSV) or spreadsheet (XLSX,XLS) you have to be importeduse the Windows [https://docs.microsoft. com/en-type (opcional) us/windows- clear_and_add server/administration/windows- 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 Filecommands/call CALL] command. It is necessary to be careful not to duplicate any dataIe.: -wait (opcional) - waits for the end of the import. It is needed to test '''Output StatusCALL''' C:\TaticView\tvcli -noerror (opcional) cmd import_file - does not notify the user if an error occurs during the process -notifyshare (opcinal) jonathan@sadig.com - sends data update notification to users who have these data file dashboards shared when the importing process ends without errors"C:\Users\jonathan\Documents\TaticView\Import Files\rh.xlsx" -datamart 673 -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" -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 -noerror'''
==== Evaluating if command execution was successful ==== <!--T:27-->
=== Command return test ===<!--T:28-->At end of a command execution, TVCli returns specific codes to inform the success or failure of the command. This allows the BAT file to verify if the previous TVCli command was completed successfully.
The TVCI executable returns different <!--T:55-->Currently, the available codes to report the success or failure during the execution process.are:
<!--T:29--> '''0 - Success''' '''8 - Error'''
A notification is sent to the user if an error occurs during the import process<!--T:30-->You can perform treatments in your automation script based on these return codes.A log with the imports details is generated in the logs directory, below the directory where TVcli was installedFor this you can [https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-r2-and-2012/cc754335(v=ws.11) use ERROLEVEL] Windows environment variable. Ie.:
An example of Windows running script <!--T:56-->if %errorlevel% == 0 ( echo SALES updated successfully! ) else ( echo Problems updating SALES! )
'''tvcli ==== BAT (Script) example ==== <!-cmd import_file -user meuemail@email.com T:31-datamart 246 -file "c:\taticview\imp\planilha.xlsx" -notifyshare'''> '''Bellow we show you a script sample that imports two files to different DataMarts (ids 674 and 673) and test the ERRORLEVEL environment variable to evaluate if errorlevel <> 0''' '''Error notification by email''' '''fi'''the data update was done successfully.
<!--T:32-->
'''@ECHO OFF'''
'''call C:\TaticView\tvcli -cmd import_file -user my@email.com -file "C:\TaticView\Import Files\sales.xlsx" -datamart 674 -wait
'''if %errorlevel% == 0 (
'''echo SALES updated successfully!
''') else (
'''echo Problems updating SALES!
''')
'''call C:\TaticView\tvcli -cmd import_file -user my@email.com -file "C:\TaticView\Import Files\hr.xlsx" -datamart 673 -wait
'''if %errorlevel% == 0 (
'''echo HR updated successfully!
''') else (
'''echo Problems updating HR!
''')'''
=== More questions on how generate the automation commands? === <span style="color!--T: red;">'''Important'''</span42-->
The free version grants <!--T:44-->TaticView has a wizard the help you on this, on the Data Files properties screen, when clicking the link <i>help to generate automation import from only one data sourcecommands?</i>, it will display the [[TVCli Commands]] screen, where you can obtain preset TVCli commands. You need to configure the feature "*automatic data update*" in your subscription All you have to automate the imports of more do is inform some required data sources.
<!--T:43-->
You can also open a [https://support.taticview.com/open.php/?&lang=en_US support ticket]. In case you are having problems during the TVCli configuration process. It will be a pleasure to help you.
</translate>