I want to return only certain columns from my table

No matter how I try I end up getting an extra value in my returned object viz. “_class” - I’m not sure what is it and how do I get rid of it, I couldn’t find it in the permission section and I couldn’t figure out a wat within the codeless block to remove it or just select those columns that I seek to return - please help.

Hello @CP_D

Could you please share the code sample which doesn’t work for you and what kind of BL you use (API Service or EventHandler)?

I’m using the codeless part to fetch data from my table, but in the response I’m getting an extra property named “_class” which I don’t to return. My table has multiple columns but I need to return only a few columns out of them.

I don’t have any code - just using the codeless feature.

or, the main question still: What kind of BusinessLogic do you use (API Service or EventHandler)?

In order to give you the right direction I need to know what logic you’ve already got, so any screenshots might help.

Btw, the ___class this is a system property which is needed for correct mapping in our SDK, do you use our SDK on the client?

@vladimir-upirov now I got the question, please ignore my ignorance, I’ve just started using Backendless. I’m using the API Service to invoke the endpoint.
I am the very nascent stage right now, I got rid other unwanted columns using Permission TAB but “_class” is something that I’m unable to get rid of:

I’m not using the SDK, I’m using Codeless to create REST API endpoints, currently testing out the endpoints before I deploy them to Web apps.

Alright,

In the main “API Service block” on the bottom you can see the “return” connector, so we need to go though all the items and return only necessary properties for each table object, try the following logic:

1 Like

This has solved the issue :slight_smile: Thank you so much @vladimir-upirov
But, I’ve another question, in case I would like to change the property names in the response, how can I achieve that - and how can I select only my intended fields from the table (without using the Permission TAB)? Some more context can help me time in future as well.

using the “Map Items in List” you can build any object, the main purpose of the block is to create a new list

1 Like