Let's suppose you want to create a task that loads a CSV file into an HTML file on a daily basis. This task is meant to be part of a PHP script, but you are unfamiliar with PHP and are unsure of how to write the code. Good news, you can use the Sample Data Toolkit UI to figure out this code for you as follows:
1) Go to the app page for the Simple Data Toolkit UI, at the time of this writing it is here: https://www.vis-software.com/#sdtk
2) Click Choose Files.
3) Find the file you want to convert.
4) Click Open.
5) Select the output type you want, for this tutorial we will select HTMLTable.
6) Then for script, select PHP.
7) Then click Download Script.
You will now have a PHP script that uses SDTK to convert the file you selected to an HTML. You can now either run this script or integrate it with another one.
If you need to install SDTK for PHP, you can do it by downloading the latest version from SourceForge, unzipping it, and placing it in your include path. At the time of this writing, this can be found here: https://sourceforge.net/projects/simple-data-toolkit/files/0.1.3/sdtk-php.zip/download
The script will look something like this:
use comsdtktableConverter;
set_include_path(get_include_path().PATH_SEPARATOR.__DIR__.'/lib');
spl_autoload_register(
function() {
= stream_resolve_include_path(str_replace('\\', '/', ) .'.php');
if () {
include_once ;
}
}
);
phpBoot::__hx__init();
Converter::start()->readFile("ga_sample.csv")->csv()->textOnly()->output()->writeFile("ga_sample.htmltable")->htmlTable()->execute();
readfile("ga_sample.htmltable");
?>
from sdtk import com_sdtk_api_GitAPI def printer(data, reader): print(reader.toArrayOfNativeMaps(None)) com_sdtk_api_GitAPI.reposAPI().retrieveData({"owner": "Vis-LLC"}, printer)To retrieve all branches a repo has using Simple Data Toolkit, we can do the following:
from sdtk import com_sdtk_api_GitAPI def printer(data, reader): print(reader.toArrayOfNativeMaps(None)) com_sdtk_api_GitAPI.branchesAPI().retrieveData({"owner": "Vis-LLC", "repo": "Simple-Data-Toolkit"}, printer)To retrieve all the files in a branch using Simple Data Toolkit, we can do the following:
from sdtk import com_sdtk_api_GitAPI def printer(data, reader): print(reader.toArrayOfNativeMaps(None)) com_sdtk_api_GitAPI.filesAPI().retrieveData({"owner": "Vis-LLC", "repo": "Simple-Data-Toolkit", "branch": "main"}, printer)To retrieve the data in a file using Simple Data Toolkit, we can do the following:
from sdtk import com_sdtk_api_GitAPI def printerData(data, reader): print(data) com_sdtk_api_GitAPI.retrieveAPI().retrieveData({"owner": "Vis-LLC", "repo": "Simple-Data-Toolkit-UI", "branch": "main", "path": "index.html"}, printerData)We can also login using a personal access token (https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens)
from sdtk import com_sdtk_api_GitAPI def printerData(data, reader): print(data) com_sdtk_api_GitAPI.instance().setKey("Personal Access Token Here").retrieveAPI().retrieveData({"owner": "Vis-LLC", "repo": "Simple-Data-Toolkit-UI", "branch": "main", "path": "index.html"}, printerData)Field Engine – Tutorial – Basic Hex Grid with HTMLOn occassion, we need to display information in hex grids. With Field Engine, this is a relatively painless task. We need to include the Field Engine files: <link href="FieldEngine.css" rel="stylesheet" /> <link href="FieldEngine-Defaults.css" rel="stylesheet" /> <script src="fe-browser.js"></script> Then we need to specify the CSS for the hex grid, we’re going to make our borders black and our hexes white: .field-hex .field_view_inner { background-color: black; } .field-hex .field_location { background-color: white; color: black; } Then we specify the hex grid with a table and the class field-hex, like so: <table class="field-hex" columns="3" rows="3" borderWidth=”1px” borderColor=”black”> <tr><td>123</td><td>456</td><td>123</td><td>456</td><td>123</td><td>456</td><td>123</td><td>456</td></tr> <tr><td>789</td><td>012</td><td>789</td><td>012</td><td>789</td><td>012</td><td>789</td><td>012</td></tr> <tr><td>123</td><td>456</td><td>123</td><td>456</td><td>123</td><td>456</td><td>123</td><td>456</td></tr> <tr><td>789</td><td>012</td><td>789</td><td>012</td><td>789</td><td>012</td><td>789</td><td>012</td></tr> <tr><td>123</td><td>456</td><td>123</td><td>456</td><td>123</td><td>456</td><td>123</td><td>456</td></tr> <tr><td>789</td><td>012</td><td>789</td><td>012</td><td>789</td><td>012</td><td>789</td><td>012</td></tr> <tr><td>123</td><td>456</td><td>123</td><td>456</td><td>123</td><td>456</td><td>123</td><td>456</td></tr> <tr><td>789</td><td>012</td><td>789</td><td>012</td><td>789</td><td>012</td><td>789</td><td>012</td></tr> <tr><td>123</td><td>456</td><td>123</td><td>456</td><td>123</td><td>456</td><td>123</td><td>456</td></tr> <tr><td>789</td><td>012</td><td>789</td><td>012</td><td>789</td><td>012</td><td>789</td><td>012</td></tr> </table> And like magic, we have a hex grid.Field Engine – Tutorial – Basic Scrollable Table with HTMLFrequently we need a table that a user can scroll through to present data for users. This is very easy with Field Engine and can be done with a few simple steps. We need to include the Field Engine files: <link href="FieldEngine.css" rel="stylesheet" /> <link href="FieldEngine-Defaults.css" rel="stylesheet" /> <script src="fe-browser.js"></script> Then we need to specify the CSS for the hex grid, we’re going to make our borders black and our hexes white: .field-hex .field_view_inner { background-color: black; } .field-hex .field_location { background-color: white; color: black; } Then we specify the scrollable table with a table and the class field-table <table class="field-table" columns="3" rows="3"> <tr><th>Col A</th><th>Col B</th></tr> <tr><td>123</td><td>456</td><td>123</td><td>456</td><td>123</td><td>456</td><td>123</td><td>456</td></tr> <tr><td>789</td><td>012</td><td>789</td><td>012</td><td>789</td><td>012</td><td>789</td><td>012</td></tr> <tr><td>123</td><td>456</td><td>123</td><td>456</td><td>123</td><td>456</td><td>123</td><td>456</td></tr> <tr><td>789</td><td>012</td><td>789</td><td>012</td><td>789</td><td>012</td><td>789</td><td>012</td></tr> <tr><td>123</td><td>456</td><td>123</td><td>456</td><td>123</td><td>456</td><td>123</td><td>456</td></tr> <tr><td>789</td><td>012</td><td>789</td><td>012</td><td>789</td><td>012</td><td>789</td><td>012</td></tr> <tr><td>123</td><td>456</td><td>123</td><td>456</td><td>123</td><td>456</td><td>123</td><td>456</td></tr> <tr><td>789</td><td>012</td><td>789</td><td>012</td><td>789</td><td>012</td><td>789</td><td>012</td></tr> <tr><td>123</td><td>456</td><td>123</td><td>456</td><td>123</td><td>456</td><td>123</td><td>456</td></tr> <tr><td>789</td><td>012</td><td>789</td><td>012</td><td>789</td><td>012</td><td>789</td><td>012</td></tr> </table> And like that you have a scrollable table. Note that columns and rows specify the size of the view of the data.Field Engine – Tutorial – Basic Vertical Menu with HTMLAt times we need to display a vertical menu for users. This is very easy with Field Engine and can be done with a few simple steps. We need to include the Field Engine files: <link href="FieldEngine.css" rel="stylesheet" /> <link href="FieldEngine-Defaults.css" rel="stylesheet" /> <script src="fe-browser.js"></script> Then we need to specify the CSS for the hex grid, we’re going to make our borders black and our hexes white: .field-hex .field_view_inner { background-color: black; } .field-hex .field_location { background-color: white; color: black; } Then we specify the scrollable table with a ul tag and the class field-vertical-menu <ul class="field-vertical-menu"> <li>Menu</li> <li level="1" onclick="switchToTable">Table</li> <li level="1" onclick="switchToHex">Hex</li> </ul> And we'll have a fully functional vertical menu.
Connect differently.
Ortingo is a platform that makes journalism easier and information more accessible. Publish from a wide spectrum of various topics and connect with your audience with new ways of writing articles. Be part of a wealth of new information, through Ortingo.
Ready to connect differently?
Learn more about Ortingo
Any thoughts on Franklin's post?
To comment or reply, you need an Ortingo account.
Sign in or sign upHere's what Ortingoers think of Franklin's post.
There are no comments on this post.