Hi,
i am little bit confused how i can update a variable in a simple way which is already binded to a logic or query.
Let me explain you, please (just remember that everything is a basic approach):
- I have a Dropzone where i upload file(s) and show the uploaded files in a table.
- To retrieve the metas from the files i use following query:
function getFileMetadataAndData() {
const files = fileDrop.value || [];
const fileResults = files.map(file => ({
name: file.name,
type: file.type,
sizeBytes: file.sizeBytes,
base64Data: file.base64Data,
dataURL: `data:${file.type};base64,${file.base64Data}`
}));
const blobResults = files.map(file => new Blob([file.base64Data], { type: file.type }));
return { fileResults};
}
return getFileMetadataAndData();
- After retrieving the files, lets say, i want to delete one file, which is in this case "1.webp". For that one i have another query, which is comparing the selected files from the table and the uploaded files. It will return me the difference to "filesForUpload"
return ((selectedFilesTable !== null) ? (() => {
const fileMetadata = getFileMetadataAndData.data.fileResults;
const filteredFiles = fileMetadata.filter(file => !selectedFilesTable.value.some(selectedFile => selectedFile.name === file.name));
getFileMetadataAndData.data.fileResults = filteredFiles;
return filteredFiles;
})() : getFileMetadataAndData.data.fileResults);
Basically ("getFileMetadataAndData" - "selectedFilesTable")
- Now i am using "filesForUpload" to display the table, so as i said i will delete 1.webp
Its working.
But my problem is, that i am getting the variable "filesForUpload" is binded to the output of the query "getFileMetadataAndData"
I really need to update this variable "filesForUpload", without always retrieving from "getFileMetadataAndData" otherwise i will basically delete one file in the variable, but if i delete seperately another one, the first deleted will appear again.
![:smiley: :smiley:](https://community.retool.com/images/emoji/apple/smiley.png?v=12)
Is there a way to override the variable "filesForUpload", to not be binded anymore after i made the second query which is "deleteLogicTable" ?
You dont need to understand my logic i built fully, it is something i need. Just how to override the binded variable with another value.