TypeError: Member "push" is not available in struct SmartRegistryData.CDMD memory[] memory outside of storage

Viewed 753
**// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
contract SmartRegistryData{
    struct TP {
        uint id;
    }
    struct OP {
        uint id;
    }
    struct BP{
        uint id;
    }
    //ContractDescriptionMetaData
    struct CDMD {
            uint ID;
            address providerAdress;
            TP TechnicalPerspective;
            OP OperationalPerspective;
            BP BusnissPerspective;
        } 
        mapping(uint => CDMD) public CDMDS;
        mapping(address => CDMD) public CDMDSA;
    
    struct PROVIDER{
        uint8 id;
        string name;
        address publicAddress;
        string entrepriseName;
        string entreprisedomain;
        string entreprisedescription;
    }
    // Store provider 
    mapping( address  => PROVIDER) public _listproviders;


    function retreiveCDMDbyProvider(address _publicAddress, address publicAddress)public{
        CDMD [] memory CDMDarray = new CDMD[](100);
       // CDMD balance[] = new CDMD[](100);
        CDMD storage  cdmd = CDMDSA[_publicAddress];
        if(CDMDSA[_publicAddress].providerAdress== publicAddress){
            CDMD memory cdma = CDMDSA[_publicAddress];
           //balance.push(cdma);
        }
    }
}**

when I'm typing --- truffle compile I get this error how Can I push a struct into a dynamic array ?? there is another solution to retrieve a set of struct according to a specified attribute, such as address.

0 Answers
Related