Quote from
paultomo on September 29, 2025, 7:12 pm
I need to export the data added to a table as a backup on an Android mobile phone app.
So far I have managed to save a file by using the "cordova-plugin-save-dialog"
I've added <plugin name="cordova-plugin-save-dialog" source="npm" /> as an extra to the additional config.xml codes.
And with the following code, a file can be saved without any issues in the Downloads Folder.
SetVar [SavedText] [MyData]
BeginJS
let blob = new Blob(["[SavedText]"], {type: "text/plain"});
let fileName = "MyBackup.txt";
cordova.plugins.saveDialog.saveFile(blob, fileName).then(uri => {
console.info("The file has been successfully saved to", uri);
}).catch(reason => {
console.warn(reason);
});
EndJS
However, what gets written to the created file is just the text "[SavedText]" the variables name, and not the full list items from the table.
I know it's an issue with how I have tried to define the variable for use in the following line:
let blob = new Blob(["[SavedText]"], {type: "text/plain"});
and probably down to what's highlighted in Red, as it's just writing the text added in the "quotes". I've tried all sorts of different ways to add the variable but I can't seem to work out how to add it so the full list items from the table gets written to the text file when it's created.
It's probably a simple formating change to how the variable is coded that's needed, so any advice is appreciated.
Thanks
I need to export the data added to a table as a backup on an Android mobile phone app.
So far I have managed to save a file by using the "cordova-plugin-save-dialog"
I've added <plugin name="cordova-plugin-save-dialog" source="npm" /> as an extra to the additional config.xml codes.
And with the following code, a file can be saved without any issues in the Downloads Folder.
SetVar [SavedText] [MyData]
BeginJS
let blob = new Blob(["[SavedText]"], {type: "text/plain"});
let fileName = "MyBackup.txt";
cordova.plugins.saveDialog.saveFile(blob, fileName).then(uri => {
console.info("The file has been successfully saved to", uri);
}).catch(reason => {
console.warn(reason);
});
EndJS
However, what gets written to the created file is just the text "[SavedText]" the variables name, and not the full list items from the table.
I know it's an issue with how I have tried to define the variable for use in the following line:
let blob = new Blob(["[SavedText]"], {type: "text/plain"});
and probably down to what's highlighted in Red, as it's just writing the text added in the "quotes". I've tried all sorts of different ways to add the variable but I can't seem to work out how to add it so the full list items from the table gets written to the text file when it's created.
It's probably a simple formating change to how the variable is coded that's needed, so any advice is appreciated.
Thanks