0

I am creating the following contract:

pragma solidity ^ 0.4.17; contract TodoList { event NewTodo(uint todoId, string value); event DeleteTodo(uint todoId, string value); mapping(uint => address) public todoOwner; mapping(address => uint) ownerTodoCount; TodoItem[] public todoItems; struct TodoItem { string value; //TODO submit ether to a TodoItem bool active; } function createTodo(string _value) internal returns(uint) { uint id = todoItems.push(TodoItem(_value, true)) - 1; todoOwner[id] = msg.sender; ownerTodoCount[msg.sender]++; NewTodo(id, _value); return id; } function getAllTodos() constant returns(string[], bool[]) { uint length = todoItems.length; string[] memory values = new string[](length); bool[] memory actives = new bool[](length); for (uint i = 0; i < length; i++) { values[i] = todoItems[i].value; actives[i] = todoItems[i].active; } return (values, actives); } } 

I would like to display all todos by a user. For this I created the getAllTodos function.

However, when doing truffle compile I get the following error:

UnimplementedFeatureError: Nested dynamic arrays not implemented here.

Any suggestions how to access all todos?

1 Answer 1

2

So dynamic nested arrays are something not perfectly handled by solidity as of now. Every time you access a function involving a nested array, it must be internal. Thus, I am guessing the error could be in function getAllTodos whose access scope isn't specified, thus defaulting to public.

I hope this works! (PS- I have heard that this could also fail because nested arrays isn't fully implemented yet, but well worth a try

2
  • Thx for your reply! Would you be so kind to add a sample code, how to do it better? I guess this might be highly relevant for future "answer" searchers. Commented Feb 2, 2018 at 5:26
  • So I think the code could work if you have the following function definition: function getAllTodos() internal returns(string[], bool[]) Commented Feb 2, 2018 at 15:31

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.