Support Topics Documentation Slack YouTube Blog

How can I fetch only particular columns in codeless?


(Rohan P) #1

Suppose i have a table with columns name, age, city, state.
How can i fetch only names in codeless.
Right now I tried with LoadTableObjects it gives me all the data of the table.

32%20PM

How can I fetch only particular column?


(Stanislaw Grin) #2

Use properties param, specify there a list of properties which you would like to get (only) and you’ll retrieve nothing but that props (including object ID of course).
See documentation here: https://backendless.com/docs/rest/data_general_api.html#general-object-retrieval-api


(Rohan P) #3

Thank you for the reply @stanislaw-grin, Could you tell me which block should i use for setting property


(Stanislaw Grin) #4

It should be an array of properties, so use Create List With block and put there your property


(Rohan P) #5

Thank you so much @stanislaw-grin.

I am getting response as
[
{
“___jsonclass”: “mysql.Details”,
“name”: “John”,
“___class”: “mysql.Details”
},
{
“___jsonclass”: “mysql.Details”,
“name”: “Stella”,
“___class”: “mysql.Details”
}
]

I am getting response with ___jsonclass & ___class, Is it possible to remove these and send?


(Stanislaw Grin) #7

You can delete it before sending to client using Codeless. Map over list of objects and delete those properties in each object, then send it’s result


(Rohan P) #8

Okay cool, Also how can i specify multiple column names, right now if I add name, age inside the text it does’nt work properly.


(Rohan P) #9

I got it Thanks alot @grin


(Stanislaw Grin) #10

Click on gear icon and add as many as you need additional items (drag item to list):
image


(Sergey Kukurudzyak) #11


(Rohan P) #12

Thank you so much @grin