Difference between revisions of "Automate Update data"

From TaticView
Jump to: navigation, search
 
(45 intermediate revisions by the same user not shown)
Line 21: Line 21:
 
<!--T:38-->
 
<!--T:38-->
 
<span style="color: red;">'''Important:'''</span>  
 
<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.
+
* 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 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>).
 
* 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>).
Line 28: Line 28:
 
=== Installing TVCli === <!--T:5-->
 
=== 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-->
 
<!--T:6-->
Download the installer first
+
* '''Download the [[TVCli Download|latest version]]  
* <u>[https://wiki.taticview.com/taticfiles/tvcli-windows-installer.exe Windows]</u>
 
 
 
  
 
<!--T:51-->
 
<!--T:51-->
'''''Attention'''''<br>
 
 
The browser can try to block the installer download. If you can't download please enter in contact with our support.
 
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 choosen advanced options.  
+
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.
 
In both situations if you need contact us to help you.
  
  
 
<!--T:7-->
 
<!--T:7-->
Run the installation on the machine where the schedules will be created to run the TVCli. TVCli works through command line. After you have created the executable containing the disered command, you can schedule its running process through your disered task scheduler.
+
* '''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-->
 
=== Generating the Access TOKEN === <!--T:8-->
  
 
<!--T:9-->
 
<!--T:9-->
To automate the data updates through TCVli, it is necessary to own an '''[[Tokens|Access TOKEN]]''' created on TaticView and then register it on TVCli.
+
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-->
 
<!--T:40-->
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.
+
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-->
 
<!--T:10-->
 
There are two ways to generate an Access TOKEN:
 
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]].
  
===Using TVCli (command line)=== <!--T:11-->
+
<!--T:62-->
# Run the command through a command line requesting the generation of an Access TOKEN.
+
To help you on this, we wave a [[TVCli Commands|Wizard]]
  
  
Line 68: Line 82:
 
   <!--T:13-->
 
   <!--T:13-->
 
-cmd                  - get_token_by_password - The command responsible for requesting and storing the Access TOKEN on the TVCli settings.
 
-cmd                  - get_token_by_password - The command responsible for requesting and storing the Access TOKEN on the TVCli settings.
   -user                  - Your TaticView user (access e-mail).
+
   -user                  - Your TaticView user (access email).
 
   -password              - Your TaticView access password.
 
   -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.         
 
   -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.         
Line 76: Line 90:
 
   '''tvcli -cmd get_token_by_password -user myemail@email.com -password 123466 -token_name "TVCli Server 1" '''
 
   '''tvcli -cmd get_token_by_password -user myemail@email.com -password 123466 -token_name "TVCli Server 1" '''
  
 
+
====Using TaticView's graphical interface==== <!--T:15-->
===Using TaticView's graphical interface=== <!--T:15-->
+
 
 +
<!--T:63-->
 +
Here we will show you how to generate 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 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''';
 
# On [[File:identificacao-novo-token+en-US.png]] inform a name to identify your Access TOKEN on the list and select '''Generate new TOKEN''';
Line 90: Line 108:
 
   <!--T:17-->
 
   <!--T:17-->
 
-cmd  - store_token - The command responsible for storing the TOKENS generated on TaticView.
 
-cmd  - store_token - The command responsible for storing the TOKENS generated on TaticView.
   -user  - Your TaticView user (access e-mail).
+
   -user  - Your TaticView user (access email).
 
   -token - The token generated on TaticView.
 
   -token - The token generated on TaticView.
  
Line 96: Line 114:
 
Example:
 
Example:
 
   '''tvcli -cmd store_token -user meuemail@email.com -token 9bdr845gh5r4r1vd5d5'''
 
   '''tvcli -cmd store_token -user meuemail@email.com -token 9bdr845gh5r4r1vd5d5'''
 
  
 
=== Updating your data automatically === <!--T:19-->
 
=== Updating your data automatically === <!--T:19-->
Line 132: Line 149:
 
<!--T:24-->
 
<!--T:24-->
 
Command Syntax:
 
Command Syntax:
   '''tvcli -cmd import_file -user <your TaticView user> -datamart <data file identification code> -file "<file/spreadsheet address>" [-type "<type>"] [-wait [-notifyshare]] [-nonotifyerror]   
+
   '''tvcli -cmd import_file -user <your TaticView user> -datamart < data file identification code> -file "<file/spreadsheet address>" [-type "<type>"] [-wait [-notifyshare]] [-nonotifyerror]   
 
  '''
 
  '''
  
 
   <!--T:25-->
 
   <!--T:25-->
 
-cmd                  - import_file  - Command that uploads your files and add them to the update queue.
 
-cmd                  - import_file  - Command that uploads your files and add them to the update queue.
   -user                  - Your TaticView user (access e-mail).
+
   -user                  - Your TaticView user (access email).
 
   -datamart              - The identification code of the data file obtained through the properties option on the TaticView main page.
 
   -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).
 
   -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).
Line 157: Line 174:
 
   '''Call "C:\Program Files\TvCli\tvcli" -cmd import_file -user myemail@email.com -datamart 246 -file "D:\taticview\imp\spreadsheet.xlsx" -wait'''
 
   '''Call "C:\Program Files\TvCli\tvcli" -cmd import_file -user myemail@email.com -datamart 246 -file "D:\taticview\imp\spreadsheet.xlsx" -wait'''
  
=== TVCli version === <!--T:35-->  
+
=== Running TVCli from BAT (Script) file === <!--T:52-->
  
<!--T:36-->
+
<!--T:53-->
You can run the <i>-version</i> command to see which TVCli version is installed on your computer. This command displays the TVCli version on the console and registers it on the TVCli log.
+
You can create BAT files to schedule a bunch of TVCli commands. Doing so the entire process can be automated. As you can schedule using Windows scheduler or other similar tool.
  
  
<!--T:37-->
+
<!--T:54-->
Command Syntax:  
+
'''''Attention'''''<br>
  '''tvcli -version'''
+
To execute TVCli from a BAT file, you have to use the Windows [https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/call CALL] command. Ie.:
 +
'''CALL''' C:\TaticView\tvcli -cmd import_file -user jonathan@sadig.com -file "C:\Users\jonathan\Documents\TaticView\Import Files\rh.xlsx" -datamart 673 -wait
  
=== TVCli log (since version 1.1) === <!--T:47-->
 
  
<!--T:48-->
+
==== Evaluating if command execution was successful  ==== <!--T:27-->
You can run the <i>show_logs</i> command to show the log file.
 
 
 
<!--T:49-->
 
Command Syntax:
 
  '''tvcli -cmd show_logs''' - Show the current day logs'''
 
  '''tvcli -cmd show_logs -all''' - Show all logs in the logs directory'''
 
  
 +
<!--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.
  
=== Commands response test === <!--T:27-->
+
<!--T:55-->
 
+
Currently, the available codes are:
<!--T:28-->
 
TVCli executable returns specific codes to inform the success or failure of its commands. Currently, the available codes are:
 
  
 
   <!--T:29-->
 
   <!--T:29-->
'''0 - Success'''
+
'''0 - Success'''
  '''8 - Error'''
+
  '''8 - Error'''
  
 
<!--T:30-->
 
<!--T:30-->
 
You can perform treatments in your automation script based on these return codes.
 
You can perform treatments in your automation script based on these return codes.
 +
For 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.:
  
=== Questions on how generate the automation commands? === <!--T:42-->
+
<!--T:56-->
 
+
if %errorlevel% == 0 (
<!--T:43-->
+
    echo SALES updated successfully!
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.
+
) else (
 
+
    echo Problems updating SALES!
<!--T:44-->
+
)
Also, on the Data Files properties screen, when clicking the link <i>help to generate automation commands?</i>, it will display the [[TVCli Commands]] screen, where you can obtain preset TVCli commands. All you have to do is inform some required data.
 
  
=== Script example === <!--T:31-->
+
==== BAT (Script) example ==== <!--T:31-->
 +
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 the data update was done successfully.
  
 
  <!--T:32-->
 
  <!--T:32-->
'''@ECHO OFF'''
+
'''@ECHO OFF'''
  '''call C:\TaticView\tvcli -cmd import_file -user jonathan@sadig.com -file "C:\Users\jonathan\Documents\TaticView\Import Files\sales.xlsx" -datamart 674 -wait
+
  '''call C:\TaticView\tvcli -cmd import_file -user my@email.com -file "C:\TaticView\Import Files\sales.xlsx" -datamart 674 -wait
 
  '''if %errorlevel% == 0 (
 
  '''if %errorlevel% == 0 (
 
  '''echo SALES updated successfully!
 
  '''echo SALES updated successfully!
Line 208: Line 220:
 
  '''echo Problems updating SALES!
 
  '''echo Problems updating SALES!
 
  ''')
 
  ''')
  '''call C:\TaticView\tvcli -cmd import_file -user jonathan@sadig.com -file "C:\Users\jonathan\Documents\TaticView\Import Files\rh.xlsx" -datamart 673 -wait
+
  '''call C:\TaticView\tvcli -cmd import_file -user my@email.com -file "C:\TaticView\Import Files\hr.xlsx" -datamart 673 -wait
 
  '''if %errorlevel% == 0 (
 
  '''if %errorlevel% == 0 (
   '''echo RH updated successfully!
+
   '''echo HR updated successfully!
 
  ''') else (
 
  ''') else (
   '''echo Problems updating RH!
+
   '''echo Problems updating HR!
 
  ''')'''
 
  ''')'''
 +
 +
=== More questions on how generate the automation commands? === <!--T:42-->
 +
 +
<!--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 commands?</i>, it will display the [[TVCli Commands]] screen, where you can obtain preset TVCli commands. All you have to do is inform some required data.
 +
 +
<!--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>
 
</translate>

Latest revision as of 13:26, 15 April 2023

Other languages:
English • ‎português do Brasil


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

To do so, it is necessary to adjust the settings and to use the command line program TVCli.

See below the required steps to automate the data updates.


Important:

  • To use TVCli, the computer where it will be configured must have java from version 8 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: C:\Users\<user>\AppData\Local\TVCli\Logs).


Installing TVCli

For now, we have only a user friendly installer for Windows. If you need install TVCli in other platforms, please contact us at Support. We are glad to to help you to install it in you environment.

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.


  • Run the installation on the computer where the schedules will be created to run the TVCli.


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.
To install and execute TVCli on you computer we need Java JRE version 1.8.0_200 or newer installed.
On Java JRE install and troubleshooting we can help you in case of doubts.

Generating the Access TOKEN

To automate the data updates through TCVli, it is necessary to own an Access TOKEN created on TaticView and then register it on TVCli.

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


Here we will show you how to generate a token whit TaticView interface.

There are two ways to generate an Access TOKEN:

The main difference between them, besides the way they are generated, is that command line selves, while the created by TaticView interface don't refresh them selves (expire), and need to be recreated.


Using TVCli command line

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

To help you on this, we wave a Wizard


Command Syntax:

 tvcli -cmd get_token_by_password -user <your TaticView user> -password <your TaticView password> [-token_name "<token name>"]
 -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.         

Example:

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

Using TaticView's graphical interface

Here we will show you how to generate a token whit TaticView interface.

  1. On the TaticiView home screen, select My Acount and click on the Access TOKENS button;
  2. On Identificacao-novo-token+en-US.png inform a name to identify your Access TOKEN on the list and select Generate new TOKEN;
  3. A new Access TOKEN will be generated Generated-token+en-US.png
  4. Run the TVCli TOKEN storing command (store_token), informing the last generated TOKEN;


Command Syntax:

 tvcli -cmd store_token -user <your TaticView user> -token <the token generated on TaticView>
 -cmd   - store_token - The command responsible for storing the TOKENS generated on TaticView.
 -user  - Your TaticView user (access email).
 -token - The token generated on TaticView.

Example:

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

Updating your data automatically

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.

After that, it will be necessary to enable the automatic update to the desired data file. For this you must access the properties of the desired Datasource. Access is available in the context menu of the Datasource card in the TaticView main page:

On desktop
Datasources properties en-US.png
In mobile devices
Datasources options mobile en-US.png Datasources properties mobile en-US.png


Then, the Automatic importation option should be enabled. When you do this, you will see the data file code, as in the example below:


Automatic-importation+en-US.PNG


You can execute the data import automatically using the identifier code through command line if the data file has permission to be updated automatically.


Command Syntax:

 tvcli -cmd import_file -user <your TaticView user> -datamart < data file identification code> -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 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 -wait command. 

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

You can create BAT files to schedule a bunch of TVCli commands. Doing so the entire process can be automated. As you can schedule using Windows scheduler or other similar tool.


Attention
To execute TVCli from a BAT file, you have to use the Windows CALL command. Ie.:

CALL C:\TaticView\tvcli -cmd import_file -user jonathan@sadig.com -file "C:\Users\jonathan\Documents\TaticView\Import Files\rh.xlsx" -datamart 673 -wait


Evaluating if command execution was successful

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.

Currently, the available codes are:

  0 - Success
  8 - Error

You can perform treatments in your automation script based on these return codes. For this you can use ERROLEVEL Windows environment variable. Ie.:

if %errorlevel% == 0 (
   echo SALES updated successfully!
) else (
   echo Problems updating SALES!
)

BAT (Script) example

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 the data update was done successfully.

 @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?

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

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