I had a case like this. A Document Content Type with Taxonomy Term like this **Title** **Category :** - CAT A - CAT B - CAT C **Doc Number** When user select CAT A then do some query to find last number of node with CAT A. If there is no data found then it will give starting number, if there is data found it will increment last number of node CAT A. Every Category will have its own number format and reset yearly. This number will be stored in the Doc Number Field. Whether there is a good idea for this case? I know PHP a little, but what makes me confused is how to know which category is selected before I save this node.