Backendless Support
 
Answered

cant fetch data from backendless table

I have a backendless table FtpTable the screenshot of which I have

attached.I am trying to fetch the hostFtp,usernameFtp and passwordFtp

using the getter and setter method but it shows nothing.Also I cannot

understand where to exactly use the backendless Table Name FtpTable

fetch data in app.

following is my code

BackendlessDataQuery query = new BackendlessDataQuery();

QueryOptions queryOptions = new QueryOptions();

String whereClause = "created";

queryOptions.addSortByOption(whereClause);

query.setQueryOptions(queryOptions);

//Backendless.Data.of( "TABLE-NAME" ).find( query, AsyncCallback<BackendlessCollection<Map>> callback );

Backendless.Data.of(NewsAgencies.class).find(query, new AsyncCallback<BackendlessCollection<NewsAgencies>>() {

@Override

public void handleResponse(BackendlessCollection<NewsAgencies> newsAgenciesBackendlessCollection) {

NewsAgencies newsAgencies;

for (NewsAgencies total : newsAgenciesBackendlessCollection.getCurrentPage()) {

newsAgencies = new NewsAgencies();

newsAgencies.setUsernameFtp(total.getUsernameFtp("usernameFtp"));

newsAgencies.setPasswordFtp(total.getPasswordFtp("passwordFtp"));

newsAgencies.setHostFtp(total.getHostFtp("hostFtp"));

newsAgencies.setNewsAgency(total.getNewsAgency("newsAgency"));

Toast.makeText(SubmitActivity.this, "username:"+ total.getUsernameFtp("usernameFtp"), Toast.LENGTH_LONG).show();

//taxiLists.add(taxiList);

//TaxiAdapter adapter = new TaxiAdapter(getActivity(), taxiLists);

//listview.setAdapter(adapter);

//progressBar.setVisibility(View.GONE);

}

}

@Override

public void handleFault(BackendlessFault backendlessFault) {

}

});

Leave a Comment

Comments (2)

photo
1

Hello,

1. The where clause in your code does not look right. It needs to be formatted as an expression following the syntax of SQL (the WHERE part of an SQL statement)

  1. String whereClause = "created";

2. To fetch data from the "FtpTable", you can create the FtpTable.java class which has the same fields as the names of the columns in the table. Then you can fetch the data with:

  1. Backendless.Data.of(FtpTable.class).find(query, ...

Regards,

Mark

photo
1

Thank Mark.Its working now :)