Tables Programming - Discussion

Welcome to the discussion thread about this lecture section. Here you can feel free to discuss the topic at hand and ask questions.

On the removeall ACTION. In EOS studio it compiles and deploy’s perfect. It also executes and comes back with Execution succeed. Transation id: xxxxxx but it does not do anything. It also does the same thing on the multiple accounts I created.

Is this the same for you?

Just to let you know there is a 404 page not found error on your dogcontract2.cpp link.
(and I am signed into github!)

i.e.

Part 3 - Test Driving our New Index

Complete Code: https://github.com/filipmartinsson/eos-programming/blob/master/Multi-Index-Table/src/dogcontract2.cpp

I should also say THANK YOU - your EOS class is a massive help to me!!!

I was trying to do it alone but the EOS documentation, examples and other internet resources are terrible!!! (although I did manage to write some contracts!).

Exactly the same for me, I think I mentioned it in the video. It runs fine but doesn’t have any effect. Seems to be a bug in EOS Studio. That’s why we move on to running our own node and use command line tools for EOS 201 course. Because studio is limited in it’s functionality.

I have fixed the github link now. Should work :slight_smile:

Thank you for your feedback on the course. It makes me happy to hear. Would you mine leaving a review on facebook with your thoughts? That helps us out a lot. https://www.facebook.com/ivanontech/reviews/

1 Like

Got an error while running push action

Cleos push action cardgame insert ‘[“cardgame”,“cldog”,200]’ -p cardgame@active

Error 3120006: No available wallet

Ensure that you have created a wallet and have it open

Error Details:

You don’t have any wallet!

$ Cleos get table cardgame cardgame dogs
{
“rows”: [{
“id”: 0,
“dog_name”: “test name 3”,
“age”: 20,
“owner”: “sarada”
},{
“id”: 1,
“dog_name”: “test name 3”,
“age”: 19,
“owner”: “echo”
},{
“id”: 2,
“dog_name”: “test name 4”,
“age”: 5,
“owner”: “sarada”
}
],
“more”: false
}

what happened to id = 0 , why didn’t it fetch ?

$ Cleos get table cardgame cardgame dogs --index 2 --key-type name -L “sarada” -U “sarada”
{
“rows”: [{
“id”: 2,
“dog_name”: “test name 4”,
“age”: 5,
“owner”: “sarada”
}
],
“more”: false
}

You need to create a wallet, and it needs to be unlocked. Did you figure it out?

1 Like

Did you have dog nr 0 in the table before you created the second index? Try to empty the table all together and then add them all again.

could your give a brief meaning of the statement

Using contract::contract;

Sure! This isn’t something eos specific, it’s standard c++. It allows us to use bring the constructor of the contract class into our class. This is important since we inherit from the contract class, we also want to have access to its constructor to initialize the contract.

Here is a general description of the using keyword in c++.

A using declaration imports a name from another namespace into the current namespace. It can also be used to introduce a name into a class scope; this is most often used to promote the access level of an inherited member or bring an inherited member into the derived class for overload resolution.

Taken from https://www.oreilly.com/library/view/c-in-a/059600298X/re89.html.

@filip Just to let you that the link in the Multi-Index DB API reading assignment is broken:

It currently points back to the course directory, but from the teachable course I see that it should instead point to the EOSIO Dev documentation:

https://developers.eos.io/eosio-cpp/docs/db-api

Thank you very much for pointing that out. I have fixed it now :slight_smile:

For some personal reasons, I prefer having headers and cpp files to having just the cpp file.

But I’m facing a problem, console doesn’t recognize dog_index except I bring copy the hpp into the cpp leaving me with just a single file.

is this normal, or am I doing something wrong.

Help Needed.

Can you post your code here? Please try to format it nicely when you post it :slight_smile:

1 Like

I guess I’m a dum*ass.

The dog_index is a private member just had to call it this way <contract_name>::dog_index.

Code’s all good.

1 Like

How would I modify the data if inputed incorrectly?

My program compiles without ERRORS but when DEPLOYING the following is displayed :slight_smile:

Deploy Failed
Unknown action setcode in contract eosio

Have you seen this before?

Great Course!! Quick Question - Businesses ask me what is the benefit of introducing this blockchain. What initial attributes can I first mention?

1 Like

Hey @filip I have deployed the code you provided for hellotable.cpp and I was able to execute the action insert without problems. But when I try to run the action remove, I get the following error: Unknown action erase in contract bob. I am using EOS Studio 0.13.1 with an EOS node v1.8.13 and EOSIO.CDT v1.6.2. I am using your code from GitHub without modifications. Do you have an idea on what is happening or how can I investigate it further? Best regards,
Jefferson

1 Like