I'm facing a problem that I can't seem to solve because my knowledge of RxJs is limited.
I've set up a file
input for users to select an XLSX
file (a spreadsheet) in order to import data into the database. Once the user confirms the file, various validations are performed on the document before insertion to prevent any issues.
The file is scanned and checked line by line. However, one of my verification processes is causing a dilemma. I need to utilize a database procedure to verify the existence of certain data in the database. The issue arises when the query returns an observer, causing my for
loop to iterate through the entire file even before receiving the query result. The console displays 'Import finish' before completing the necessary checks.
I am wondering if there's a way to pause the loop until I receive the result from the subscribe function, or if I can let the loop complete and then finalize the import once all results are obtained.
Component:
importObjectives(): void {
// Code snippet
}
Store Wallet:
checkWallets(xlsx: XLSXObjective, lineError): Observable<any> {
// Code snippet
}
Service Wallet:
checkWallets(xlsx: XLSXObjective): Observable<any> {
// Code snippet
}
Any assistance would be greatly appreciated. Thank you, and please excuse any language errors.