Solidity: How can I return a list of user-defined function?

0 votes

I want to return a list of user-defined struct

function sortByEtherValues (string category) public view returns (JobStruct[]) {
...
}

I am getting the following error:

Failed to decode output: Error: Unsupported or invalid type: tuple
Sep 26, 2018 in Blockchain by slayer
• 29,040 points

retagged Nov 22, 2018 by Priyaj 34 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

You can do it with something like this:

struct JobStruct {
  uint a;
  uint b;
  uint c;
}

function sortByEtherValues (string category) public view returns (uint, uint, uint) {
  JobStruct memory js = JobStruct(1, 2, 3);
  return (js.a, js.b, js.c);
}
answered Sep 26, 2018 by digger
• 27,620 points

Related Questions In Blockchain

+1 vote
2 answers
0 votes
1 answer

How can I get the same return value as solidity `abi.encodePacked` in Golang?

This is what I used:  package main import ( ...READ MORE

answered Sep 26, 2018 in Blockchain by slayer
• 29,040 points
235 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
63 views
0 votes
1 answer
0 votes
1 answer

Solidity geth: Error encountered during contract execution [Bad instruction]

recipes is a dynamic storage array. You need ...READ MORE

answered Oct 15, 2018 in Blockchain by Omkar
• 65,840 points
28 views
0 votes
1 answer

How do I compile a piece of Solidity Code using eris' javascript?

The easiest way to compile Solidity is ...READ MORE

answered Sep 27, 2018 in Blockchain by digger
• 27,620 points
23 views
0 votes
1 answer

How to return data on execution of invoke function?

You can do this using a response ...READ MORE

answered Jul 23, 2018 in Blockchain by digger
• 27,620 points
24 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.