Data query using codeless

I followed the alexa posts, and video. I am working on a similar skill experiment - how can i retrieve an object from database using codeless, and matching certain condition.

Hi Rk,

You can use the following codeless block to load data from a table:
http://support.backendless.com/public/attachments/661d377e57212dd561e5e955bf052779.jpg</img>

Regards,
Mark

661d377e57212dd561e5e955bf052779.jpg

Thanks - but what do I connect that to - a create object ? I was trying to connect it to get property of and it wouldn’t connect. For example - I can do get property of ‘get first object from the table’. But the load objects wouldn’t replace get first object.

1 Like

also can you give an example of where clause - i want to retrieve a particular row’s data, given i know one column’s value for that row

Could you describe the entire use-case from start to finish?

I have a table of Coutry Name and National Bird for each of them. I am getting country name as user input and I would like to retrieve and return the corresponding national Bird for that country.

I was able to return just the national Bird of first object … but am struggling to use the user input as the index for the table and get that particular object (and then I can get the bird property of that object)

Hi Rk,

So, everything is OK with Backendless API? It looks like a problem only with JS code (concerning the user input). Probably if you provide some code snippets someone from our team would be able to help you, but note that JS code questions are not the best fit for this forum - it’s dedicated to solving the problems only with Backendless services.

No, I don’t have problem with user input. My question is how to retrieve a particular row from database, where user input is the key for the row of database. Similar to how ‘first’ and ‘last’ object is returned, how can I make the database return a particular row ? Or even if I can traverse the table, I will find a way to compare the object returned from each row (not ideal).

Database is not allowed to target to particular row. In other words – yes, you may request the particular row but there is no guaranty, that it will be the same row. The sequence of rows may vary from time to time and related to inner db structure. I would recommend not to bind you logic with such behavior. Use objectId or special column with sequential numbers.

good to know, but the question remains. all i want is to get a value knowing a key, in several key value pairs. i said keyvalue pairs as rows of data in database, if it is not, that’s fine. still how do i get a value from the database by passing a key. even if i have to traverse by comparing each key and compare it until it is same as hte one i want, i can do that (though i know it is not optimal)… but i am struggling just to get a value back from database using the api…

I have a table of Coutnry Name and National Bird for each of them. I am getting country name as user input and I would like to retrieve and return the corresponding national Bird for that country. I can store country name and national bird as key value pairs in the table/database.

In case your table has columns “CountryName” and “NationalBird”, you can easily retrieve the NationalBird value by the CountryName using the following simple whereClause:

CountryName = 'value-provided-by-user'

See the documentation for more details.