I am using bussines froms plugin version 4.2.0
I have in the playload simple test:
const payload = {};
// Adiciona elementos ao payload se tiverem valor
context.panel.elements.forEach((element) => {
if (!element.value) {
return;
}
payload[element.id] = element.value;
});
// Adicionando valores fictícios ao payload
payload.values = [
[‘John’, ‘Doe’, ‘john.doe@example.com’, ‘USA’, ‘New York’, ‘Company A’, ‘Unit 1’, ‘Campaign 1’, ‘Course 1’, ‘Module 1’, ‘Module 2’, ‘In Progress’, ‘Not Started’],
[‘Jane’, ‘Smith’, ‘jane.smith@example.com’, ‘Canada’, ‘Toronto’, ‘Company B’, ‘Unit 2’, ‘Campaign 2’, ‘Course 2’, ‘Module 3’, ‘Module 4’, ‘Completed’, ‘Not Started’]
];
// Log do payload final para depuração
console.log(payload);
return payload;
in Query I have one replace
REPLACE INTO training.table (
First Name
,
Last Name
,
Email
,
Country
,
City
,
Company
,
Unit
,
Campagin
,
Course
,
Enrolled Module
,
Completed Module
,
In Progress
,
Not started
) VALUES ( ${payload} );
it is not working,
Please someone could help me !!!
My necessity is to upload csv file direct into a mysql table, but even this simple example is not working. HELPpppppppp
The custom code is
if (context.panel.response) {
context.grafana.notifySuccess([‘Update’, ‘Values updated successfully.’]);
context.grafana.locationService.reload();
} else {
context.grafana.notifyError([‘Update’, ‘An error occurred updating values.’]);
}