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,370 points

retagged Nov 22, 2018 by Priyaj 1,362 views

1 answer to this question.

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
• 26,740 points

Related Questions In Blockchain

+1 vote
2 answers
0 votes
1 answer
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,370 points
4,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
1,922 views
0 votes
1 answer

Hyperledger Sawtooth vs Quorum in concurrency and speed Ask

Summary: Both should provide similar reliability of ...READ MORE

answered Sep 26, 2018 in IoT (Internet of Things) by Upasana
• 8,620 points
1,451 views
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
• 69,220 points
1,464 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
• 26,740 points
851 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
• 26,740 points
632 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP