Variable Access

//How can i update a variable i declared outside a query inside the handleResponse and still access the updated quantity in that variable outside the query?

String whereClause = “AdvertTitle LIKE %car%”;
List data = new ArrayList<>();
int[] dataPointsArrayOfIntegers = new int[5];
Pie pie = Chart.pie();

            DataQueryBuilder queryBuilder = DataQueryBuilder.create().setProperties("Sum(NumberOfViews) as grandTotal");
            Backendless.Data.of("Master").find(queryBuilder, new AsyncCallback<List<Map>>() {

                public void handleResponse(List<Map> response) {

                   dataPointsArrayOfIntegers[index] = (int) response.get(0).get("grandTotal");
                    data.add(new ValueDataEntry(1, dataPointsArrayOfIntegers[0]));
          ;//This works, but this is NOT what i want

                public void handleFault(BackendlessFault fault) {

            });;//This DOSENT work (At this point data is null), but this is what i want.

Hi @Nkekere_Tommy_Minimann !

It looks like you need to use sync version of find for this purpose. You should use simple data = Backendless.Data.of("Master").find(queryBuilder);

Regards, Andriy