How to find elements within other elements with Accessibility Ids

I have a list of appointments that each have (elements) within that I would like to get access to by appointment. If I have the parent I want to access all the child elements within it. We’re currently working with automation ids to get an accessibility id so I’d have unique parent ids and for child elements I would keep their id’s the same since those are consistent across each appointment. What I’m asking is how would I go about accessing the elements within a specific parent by their accessibility id?

I saw there is a way to do it using this code:
parentCell.findElement(By.accessibilityId("childElement")).

if I have the child element as a variable, how would I do the code above? Would this work:
parentCell.findElement(childCell)

Also, related question. How would I go about assigning Id’s to the parent cells and grabbing those objects since the number of cells always changes? It could be 1 or 100 depending on how many appointments are made

Apologies if these questions are hard to understand, I had a hard time wrapping my head around what I’m trying to ask…

Hi Ari, maybe you can use class chain in order to reach them.

https://github.com/facebookarchive/WebDriverAgent/wiki/Class-Chain-Queries-Construction-Rules
https://developers.perfectomobile.com/display/TT/Finding+Elements+on+XCUITest+devices

Also maybe this thread may help, I used class chain in order to send keys to certain elements on-screen.

Regards!