I would like to enter the URL as the connection string in the Stimulsoft editor, then process this url and then send the http request using axios. This mechanism works almost correctly so far, but the problem is that the retrieveData is triggered for each table in the data source so if I have nested objects, the request is repeated for each this object. How can I set it up so that it sends only one request and the tables for nested objects are determined based on the result of the request for the root element?
My data adapter look like this so far:
Code: Select all
{
serviceName: "POST",
sampleConnectionString: "",
process: (command, callback) => {
switch(command.command) {
case "TestConnection": {
testConnection(command);
callback({ success: false, notice: "Error" });
break;
}
case "RetrieveSchema": {
const data = retrieveSchema(command).then(resp => {
callback({ success: true, data: resp.data });
});
break;
}
case "RetrieveData": {
retrieveData(command).then(resp => {
callback({ success: true, data: resp.data });
});
break;;
}
}
}
}
...
function retrieveSchema(command) {
return retrieveData(command)
}
function retrieveData(command) {
const url = command.connectionString;
...
return axios.get(url);
}