-
Kết nối dữ liệu từ nhiều nguồn
-
Cài đặt Python và R
-
Xử lý làm sạch dữ liệu với Tableau Prep
-
Khám phá Tài nguyên dành cho Nhà phát triển
API
—–1. API bài viết theo id – tiêu đề – nội dung
https://jsonplaceholder.typicode.com/posts
— 2. API ndwdc
http://jsonplaceholder.typicode.com/posts/1/comments
— 3. API về 20 khách hàng của nordwind_wdc
https://services.odata.org/V3/Northwind/Northwind.svc/Customers?$format=json
—4. API accounting – rất nhiều bảng
https://resellers.accounting.sageone.co.za/api/2.0.0
—-5. thời tiết tại VN sử dụng tọa độ VN và mã API: bd2ff13c557c88b365e79e7477521d63. đăng nhập ở chế độ ẩn danh Anoys. api_thoitiet
https://api.openweathermap.org/data/2.5/weather?lat=14.0583239999999&lon=108.277199&appid=bd2ff13c557c88b365e79e7477521d63
user/pass: powerbi
tên api: Powerbi_weather
—————-
Trong tableau cần xây dưng các file kết nối wdc.html
Cú pháp
<!DOCTYPE html>
<html>
<head>
<meta charset=”utf-8″ />
<title>My WDC</title>
<script src=”https://connectors.tableau.com/libs/tableauwdc-2.3.0.js”></script>
<script>
// 1. Khởi tạo Connector
(function () {
var myConnector = tableau.makeConnector();
// 2. Định nghĩa schema (cấu trúc bảng)
myConnector.getSchema = function (schemaCallback) {
var cols = [
{ id: “id”, dataType: tableau.dataTypeEnum.string },
{ id: “name”, dataType: tableau.dataTypeEnum.string }
];
var tableSchema = {
id: “exampleTable”,
alias: “My Example Table”,
columns: cols
};
schemaCallback([tableSchema]);
};
// 3. Lấy dữ liệu (đổ vào bảng)
myConnector.getData = function (table, doneCallback) {
fetch(“https://api.example.com/data”)
.then(response => response.json())
.then(data => {
let tableData = data.map(item => ({
id: item.id,
name: item.name
}));
table.appendRows(tableData);
doneCallback();
});
};
// 4. Đăng ký connector với Tableau
tableau.registerConnector(myConnector);
})();
// 5. Gửi kết nối khi người dùng click nút
function submit() {
tableau.connectionName = “My API Source”; // tên sẽ hiển thị trong Tableau
tableau.submit();
}
</script>
</head>
<body>
<h2>Kết nối API với Tableau</h2>
<button onclick=”submit()”>Tải dữ liệu</button>
</body>
</html>