I am unable to add elements to a array within the struct struct D { string name; address key; } struct Aone { string aid; B[] blist; D[] dlist; } struct B{ string bdesc; bool bstatus; C[] clist; }
struct C{
uint createTime;
string cdesc;
bool rstatus;
string ctype;
}
mapping(string => Aone) A;
I am need to add items to struct c based on aid provided function rptC(string _aid, string _c) public { B[] storage bhist = A[_aid].blist;
if(bhist.length > 0 && bhist[bhist.length-1].bstatus==false) {
bhist[bhist.length-1].clist.push(C(now,_c,false,""));
} else if(bhist[bhist.length-1].bstatus==true) {
bhist[bhist.length].clist.push(C(now,_c,false,""));
} else {
bhist[0].clist.push(C(now,_c,false,""));
}
}
I keep getting a invalid json rpc error. I am new to Solidity and need help
Thank you