on 2024 Oct 15 7:49 AM
Hello Experts!
I am requesting your help. I am currently trying to read information from a table in a live connection model from PaPM. We have a script that, upon page initialization, can read the information directly from the table when it was created from a CSV file data source. This table can be read perfectly through the Analytics Designer Table API.
I've been researching, and it seems that live connection does not support data discovery. Is there any way to achieve this? I am sharing the script below of what I've got so far.
var dataSource = Table_1.getDataSource();
var dimensions = dataSource.getDimensions(); // Obtiene las dimensiones
var measures = dataSource.getMembers("Measures", 1000); // Obtiene los miembros de la dimensión "Measures" (medidas)
var accData = dataSource.getResultSet();
var stringCSV = "";
var i = 0;
var j = 0;
var k = 0;
var m = 0;
var n = 0;
var tempString = ""; // Inicializada como cadena vacía
var dimId = ""; // Inicializada como cadena vacía
var measureName = ""; // Inicializada como cadena vacía
var dimensionValue = ""; // Para valores de dimensión
var measureValue = ""; // Para valores de medida
for (i = 0; i < dimensions.length; i++) {
tempString = stringCSV + dimensions[i].description + ",";
stringCSV = tempString;
}
for (j = 0; j < measures.length; j++) {
if (j < measures.length - 1) {
tempString = stringCSV + measures[j].description + ","; // Usa 'description' para nombre legible de la medida
} else {
tempString = stringCSV + measures[j].description + "\n";
}
stringCSV = tempString;
}
for (k = 0; k < accData.length; k++) {
// Recorre las dimensiones dinámicamente
for (m = 0; m < dimensions.length; m++) {
dimId = dimensions[m].id; // Obtiene el ID de la dimensión
dimensionValue = accData[k][dimId].formattedValue || accData[k][dimId].id || "N/A";
tempString = stringCSV + dimensionValue + ",";
stringCSV = tempString;
}
for (n = 0; n < measures.length; n++) {
measureName = measures[n].id;
measureValue = accData[k][measureName].rawValue || "N/A";
if (n < measures.length - 1) {
tempString = stringCSV + measureValue + ",";
} else {
tempString = stringCSV + measureValue + "\n";
}
stringCSV = tempString;
}
}
contextData = stringCSV;
Request clarification before answering.
User | Count |
---|---|
39 | |
15 | |
9 | |
7 | |
5 | |
5 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.