# Block indices in different versions

**URL:** https://discourse.paraview.org/t/block-indices-in-different-versions/12935
**Category:** ParaView Support
**Tags:** python
**Created:** [September 26, 2023, 1:51pm UTC](https://discourse.paraview.org/t/block-indices-in-different-versions/12935 "2023-09-26T13:51:54Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![RafaMADFT](https://discourse.paraview.org/user_avatar/discourse.paraview.org/rafamadft/32/12344_2.png) [@RafaMADFT](https://discourse.paraview.org/u/RafaMADFT)
#### Post date: [September 26, 2023, 1:51pm UTC](https://discourse.paraview.org/t/block-indices-in-different-versions/12935/1 "2023-09-26T13:51:54Z")

</div>

Good morning.  
I found a function to get the block indices of case.foam, the problem is that this function was created for paraview-5.8.0. When i run it with that version, it works propertly, but with the latest version (5.11.0), does not work.  
Do you know if i have to add any command or import something?. There is any function already done that extract the indices of a case.foam?  
Thank you so much.  
Rafa

```
def get_block_indices(composite_data_information, index=0):
    """
    Source: https://discourse.paraview.org/t/get-block-name-and-id-from-multiblock-dataset/4014/2
    :param composite_data_information:
    :param index:
    :return:
    """
    localDict = {}

    if composite_data_information.GetDataIsMultiPiece():
        index += composite_data_information.GetNumberOfChildren()
    else:
        if composite_data_information.GetDataIsComposite():
            for i in range(composite_data_information.GetNumberOfChildren()):
                index += 1
                _blockName = composite_data_information.GetName(i)
                localDict[_blockName] = index
                leafDict, index = get_block_indices(
                    composite_data_information.GetDataInformation(i).GetCompositeDataInformation(), index)
                localDict.update(leafDict)

    return localDict, index

```
