I am writing code for a contract to keep track of Theatrical plays. I get this error on this line:
play1.PlayTitle = PlayTitle; (line 62 below)
browser/teste.sol:62:13: TypeError: Member "PlayTitle" not found or not visible after argument-dependent lookup in struct Plays.PlayActionInfo storage ref[] storage ref play1.PlayTitle = PlayTitle;
^-------------^
I do have PlayTitle defined in both structs. I envision the user will enter the play title when the contract is created and when there are updates to the play information. The fact I define it twice may be part of the problem.
But I when I deleted the line containing PlayTitle, the next line ( play1.PlayWorkerName[numUpdates] = PlayWorkerName; ) got the error.
Could someone explanation the meaning of the error? Any other code suggestions would be appreciated.
I did see other questions with the same error but the solutions didn't seem relevant to my code.
For my environment configuration, I'm using Remix in a Chrome browser.
Here's all my code:
pragma solidity ^0.4.18;
contract Plays
{
//used to store information about the owner of the Play
struct TopLevelPlayInfo {
address PlayOwnerAddress;
bytes32 PlayOwnerName;
bytes32 PlayTitle;
}
//instance of the owner
TopLevelPlayInfo playi;
//map into the PlayOwner based upon the owner's address
mapping (address => TopLevelPlayInfo) public theTopLevelPlayInfo;
//used to store actions taken to complete Play
struct PlayActionInfo {
bytes32 PlayTitle;
bytes32 PlayWorkerName;
address PlayWorkerAddress;
bytes32 PlayAction;
bytes32 PlayActionDescription;
uint256 PlayActionTimestamp;
bytes32 PlayStatus;
}
//the instance of the struct
PlayActionInfo [] play1;
//map into the Play action
mapping (uint => PlayActionInfo) public thePlayActionInfo;
//State variables for storage - do I need these
// as state variables since they are also in a struct?
uint numUpdates;
address theOwnerAddress;
//will be used to ensure only owner closes Play when work is accepted
modifier onlyOwner(){
if(msg.sender != theOwnerAddress) revert();
_;
}
//constructor for contract
function Plays(bytes32 thisPlayOwnerName, bytes32 thisPlayTitle) public {
//establish the owner
playi.PlayOwnerAddress = msg.sender;
theOwnerAddress = msg.sender;
playi.PlayOwnerName = thisPlayOwnerName;
playi.PlayTitle = thisPlayTitle;
}
//used to enter a new action against thePlay
function PlayUpdate(
bytes32 PlayTitle,
bytes32 PlayWorkerName,
bytes32 PlayAction,
bytes32 PlayActionDescription,
bytes32 PlayStatus)
public {
play1.PlayTitle = PlayTitle;
play1.PlayWorkerName[numUpdates] = PlayWorkerName;
play1.PlayWorkerAddress[numUpdates] = msg.sender;
play1.PlayAction[numUpdates] = PlayAction;
play1.PlayActionDescription[numUpdates] = PlayActionDescription;
play1.PlayActionTimestamp[numUpdates] = block.timestamp;
play1.PlayStatus[numUpdates] = PlayStatus;
//update the number of updates to this contract
numUpdates++;
}
}
Thank you