How can I avoid having to open and close a database connection twice when working with a sub-workflow that is only called when a certain condition is met?

@MgntMoe I still think you would have to think about your approach. I built an example where in a loop at every iteration there would be a check if in the chunk there would be a row with fault=1. In this case, the faulty lines would be exported to a separate sheet in an Excel file. Otherwise, just the number of fault lines would be shipped.

Maybe you can take a look. It also uses SQLite as a sample database.

kn_example_switch_case_store_file_sql.knwf (158.4 KB)

1 Like