I have issue in the following smartcontract.
I have defined a struct which includes an string array. And I have defined a mapping for this struct.
struct Stonedetails {
uint stoneweight;
string stoneimagehash;
string stoneidbywholesaledealer;
string[] stoneidsbycutter;
}
mapping (uint=>Stonedetails) public stonedetailsTable;
I have stored the values in struct using the following methods inside a function by passing parameters.
stonedetailsTable[stoneid].stoneweight =stoneweight;
stonedetailsTable[stoneid].stoneimagehash =stoneimagehash;
stonedetailsTable[stoneid].stoneidbywholesaledealer =stoneidbywholesaledealer;
How can I store the values in string array? Is it the way to store the values one by one?
stonedetailsTable[stoneid1].stoneidsbycutter.push(stoneidbycuttervalue);
How can I find the length of array using stoneidsbycutter.length?
stonedetailsTable[stoneid].stoneidsbycutter.length
not working?push
followed by checking thelength
.)