0
mapping(uint256 => Data) CheckAttribute;
 struct Data{
        uint256 AttributeID;
        string attribute;
        string approve;
    }
function checkAttribute(uint256 AttributeID, string memory attribute, string memory approve) public returns (bool success){
        CheckAttribute[AttributeID] = Data(AttributeID, attribute, approve);
        return true;
}
0

When the function is called, a new entry is created of type Data and added to the mapping CheckAttribute. Also, a boolean true is returned from the function.

The given parameter AttributeID is used as the key (uint256) in the mapping. This means you can only retrieve the stored data if you have this key value. You can't, for example, list all stored key values and get the mapping data through those - you have to know the explicit key value to be able to access the mapping data.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.