It's a bit of an involved process, but as Fleeting Frames says, the key is having a stockpile of the correct type in proximity. @Sanctume thread in the hospital is marked unavailable (at least in 0.43.05), so no need to have the qualifier.
I use kanban for my manufacturing processes, so I always pull from demand back to supply. Here's what I do if you are interested (sorry... it's long).
Generally you want to start backwards so that you don't over supply your stockpiles. Instead of clothes, let's do bags because it is easier, but it's essentially the same process. I always want to have 3 empty bags in stock. So I set up an order in the clothier to produce 1 bag every day with the 'p'roduct condition of at most 3 empty pigtail bags. I set the 'r'eagent condition to at least 1 dyed pigtail cloth. I then set up a stockpile that will hold at least 3 pigtail bags (that way you can see at a glance if there is a bug in your supply line). It is important to use the 't'raits condition to specify 'empty' bag. You also either have to set the 'm'aterial to 'pig tail' or 'd'escribe the job to make pig tail bags. Whether or not you want to use the 'dyed' 't'rait is up to you.
Of course, this won't make any bags because we need pigtail cloth. I make a stockpile for pigtail cloth around the clothier (usually I make 5x5 rooms with the workshop in the middle and stockpiles around the outside -- the stockpile will hold 16 items, which is well more than enough). NEVER use bins or barrels unless you know exactly what you are doing. This message is long enough that I don't have time to explain how bins and barrels work, but basically they don't work the way you think they do and it will absolutely break your supply line if you don't know exactly how to use them. If you accidentally get something in a bin or a barrel, unspecify bins and barrels from the stockpile and dump the bin/barrel, latter reclaiming the items after they have been dumped (huge PITA).
Now you need a loom to make the cloth. Add an order for 1 pigtail cloth every day (again it is most easy to use 'd'escribe for the cloth type rather than using 'm'aterial in the conditions). 'p'roduct condition of at most 10 or so pigtail cloth (depending on how big your stockpile is). Hauled items are unavailable, so if your stockpiles take more than a day to haul between, you might end up with too many cloth. Adjust accordingly. To be honest, I never need more than 5 cloth in my stockpile. 'r'eagent condition of at least 1 dyed pigtail thread. You can also set the Workshop options to only used dyed thread, but usually I don't bother because my workflow usually generates the same result.
Again, this will not result in bags because you now need to dye the thread. Set up a dyer workshop. In the loom stockpile, take from the dyer workshop and only use links. This will ensure that the loom stockpile only has dyed thread. That in turn will mean that virtually every time your loom will use dyed thread unless you actually run out -- in which case it's reasonable to use undyed thread -- that's why I don't set it to only use dyed thread. You *do* want to turn off autoloom, though.
In the dyer's workshop set an order to dye thread and again 'd'escribe the job as 'pig tail thread'. Add a 'p'roduct condition for at most 5-10 dyed pig tail thread (the default). Set a 'r'eagent condition for at least 1 undyed pigtail thread and 1 DYE_CONTAINING (or whatever the trait is.... I forget... it's the default, though). This time, you are going to want to set up half your stockpile to contain milled dimple cup dye (under food) and half to contain pig tail thread. Be careful to turn *off* barrels *and* prepared food in the food stockpile (grr... prepared food ends up all over my fortress if I'm not careful).
Again, we want undyed thread in the dyer's stockpile, so what we're going to do is to take from the Farmer's workshop and use only links. Next add an order in the Farmer's workshop for 'process plant' (*not* any of the other processes, as discussed previously). You can't specify the material. So what I do is make a specific farmer's workshop for processing plants and make a stockpile that only contains pigtails (or whatever material you want to process -- or spin if you are doing wool). The take from the main plant stockpile, only taking from links. That will mean that you can still brew a few pigtails and it won't all end up as cloth, for instance. Set a 'p'roduct condition on the job for at most 5-10 undyed pigtail thread ('undyed' is a 't'rait condition and 'pig tail' is a 'm'aterial contition) and at least 1 processable plant (the default).
Finally, you need to make dye. This one is tricky. Again make a quern, but locate it far away from any seeds/sweet pods. Make a stockpile around it that only has dimple cups and takes from the main plant stockpile. Set up a job for 1 mill to flour job a day with conditions: 'r'eagent at least 1 millable plant and at most 2 DYE_CONTAINING (or whatever the 't'rait is). Now the trick here is that the UI won't prompt you for the DYE_CONTAINING trait -- look at your dying job to figure out what trait you need.
The other main trick about this is that you need to grow enough dimple cups that your stockpile around the quern always has dumple cups in it. Otherwise you will make some other kind of flour. Just keep an eye on it over time to ensure that you keep enough stock and if you run out, up your acreage of dimple cups in the next growing seasons.
After you have all this set up, it is now basically bullet proof. The cool thing is that apart from running out of pig tails and dimple cups, it is completely reactive. If you make pig tail clothes in the clothier, the entire system will pull to react to fill the need for more materials. I've got it set up for a maximum of one job per day, so you will only make 300 cloth a year, so you might have to up the job size to 2 or 3 per day if your demand increases. However, if you do the same thing with silk, wool and rope reeds, you have basically 1200 cloth production a year, which will probably be way more than you need.
Hope that helps!