How Do I Delete a File or a Data Source in a Task that Handles the Same File or Data Source? (Magic xpa 3.x)
When a Magic xpa task starts, all the files and data sources used by that task are opened before you get control of the program. This means that you cannot delete the file or data source from within that task.
However, you will commonly want to delete a file before a task runs. To do this, you would delete the file in a parent task, usually the one that launches the task.
In this example, we have a logic unit that deletes the old file, then calls the task that will create the file. We are using the function FileDelete(), passing it the name of the file in variable C. Because this happens in the parent task, there will be no conflict with the subtask opening the file.
The Online and Rich Client Samples projects (program EN06 and REN06)