Pagefactory dynamic webelement with wildcard

I have dynamically generated locators depends on which element is gonna be chosen from a list.

For instance, this is my generated id:


0 is the counter, meaning first element is chosen from the list. All strings before and after the counter won’t change, so start with, contains xpath method does not work.

Can I use some wildcard like
Function:TableName:{X}:submenuAction {x} is integer.

I can store the chosen number of element, but how can I use this variable inside the pagefactory element? driver.findelement can fail with staleElementException,thats why I wanna use PageFactory.