Yes, you can terminate a different workflow from within a workflow. You just need to know which workflow instance to terminate. You can do this generally, by tracking the item you started the task handler workflow on via the ID or something and then terminating all workflows of a type on the item. Alternatively, should be able to target just a particular instance if you wanted to.
Depending on your environment, there are a few methods to look at. Here is a help link to the Terminate Workflow Instances action for O365 Nintex Workflow
On-Prem, you can also look at the Call Web Service action. Although this example shows how to start a workflow, the dropdown has a lot more options to pick from, including terminating a workflow. This option is nice because it provides additional error handling as well.
Terminating a workflow should automatically cancel all related tasks that were created within the workflow itself. however, if you're producing independent tasks in a list separate to using the task based workflow actions, then you will likely need to build logic to find and delete or close those tasks.
Hopefully that helps! Please let me know if it does or if you have any additional questions.
Thanks I have now managed to create multiple workflows from one list item. The workflows that were spawned had to be Site Workflows because one workflow of a given name is allowed on a list instance.
Also I have been able to delete them through the Terminate Workflow Webservice.
My current problem is that I can't seem to pass parameters to the Site Workflow. From the normal (non webservice) Start Workflow--it is relatively easy because the parameters show up on the call. I have tried the Build String to create AssociatedData--but I'm missing something.
thanks for your help. The dropdown had all the actions.
Great to hear that helped with your first problem.
About your second issue, if I understand it correctly, it works when using the regular start workflow action, but not when you're trying to pass stuff via a Call Web Service Action?
If that is the case, have you selected the Encoding Token checkbox? Also, you'll want to use the build String action and have it look something like this;
<Data>
<StartDataItem1>value1</StartDataItem1>
<StartDataItem2>value2</StartDataItem2>
<StartDataItem3>value3</StartDataItem3>
</Data>
Here is a blog post that covers how to do this. I used this myself a while back when I ran into the same issue and this worked for me. I recommend ensuring the variables you're passing to don't use spaces in their names to keep things simple.
Passing variable values between Nintex workflows | SharePoint Rider