I hope I get your question right. Given an object “Access_code” you retrieved, you need the next “Access_code/code”? If so, you can retrieve a full list of “Access_code” from your database. You can sort this list descending. Create a list of “Access_code” with the XPath constraint that is is > than the object found. Subtract the lists and the object found, and the top of the list is your next “Access_code/code”.
If you meant it differently, please clarify.
Go make it
Does your Access_Code Entity has a unique valued Attribute which is Constructed in increasing order such as for example:
Entity : Access code
Attribute: Code :
Values: AC_212 and then next is AC_213
If this is your Scenario upon my Understanding, you can use a find last and substring string operation to find the last key value (‘_’), so that you will have the integer value, convert the string to Integer using parse integer and increment the Value and then again reconstruct the code value and make use of that string with the attribute.