I have written the following code to return an array of struct from the function getPurchaseOrderForVendor.
pragma solidity ^0.4.21;
pragma experimental ABIEncoderV2;
contract InvoiceSettlement {
struct PurchaseOrderStruct {
uint8 requisitionNumber;
uint8 poNumber;
}
PurchaseOrderStruct[10] public PurchaseOrderStructArray;
function InvoiceSettlement()
{
for (uint i = 0; i < purchaseOrderLength; i++) {
PurchaseOrderStructArray[i].requisitionNumber = 1;
PurchaseOrderStructArray[i].poNumber = 1;
}
}
function getPurchaseOrderForVendor(string vendorNameInput) constant retu rns (struct[])
{
struct[] memory y = new struct[](16);
for (uint i = 0; i < purchaseOrderLength; i++)
{
y[i] = PurchaseOrderStructArray[i];
}
return (y);
}
}
When I compile the code, I get this error:
invoiceSettlement.sol:44:80: ParserError: Expected type name function getPurchaseOrderForVendor(string vendorNameInput) constant ret urns (struct[]) ^