[Flutter] Transactions - Retrieving objects not working with paging/sorting/related objects QueryBuilder

Hello, I follow this document Retrieving objects - Backendless SDK for Flutter API Documentation
The document said " This operation retrieves data objects from a database table. The retrieval is performed according to the provided options, which allow you to:

  • Retrieve objects with a query
  • Using paging
  • Using sorting
  • With related objects"

But It’s only working with whereClause/pageSize property.
related/sortBy/offset property is not working.

My code here:

      final unitOfWork = UnitOfWork();

      DataQueryBuilder findCommentsBuilder = DataQueryBuilder();

      findCommentsBuilder.whereClause = "eventId = '$eventId'";
      findCommentsBuilder.related = ["createdBy"];

      findCommentsBuilder.sortBy = ["created DESC"];
      findCommentsBuilder.pageSize = 20;
      findCommentsBuilder.offset = 0;
      final findCommentsResult =
          unitOfWork.find(BLComment.tableName, findCommentsBuilder);
      findCommentsResultJsonKey = findCommentsResult.opResultId;

The result returns 20 comment records without related “createdBy” object, wrong sortBy, wrong offset.

It’s working perfect If I don’t use transactions as below code

    String query = "eventId = '$eventId'";
    DataQueryBuilder queryBuilder = DataQueryBuilder();

    queryBuilder.whereClause = query;
    queryBuilder.related = ["createdBy"];

    queryBuilder.sortBy = ["created DESC"];
    queryBuilder.pageSize = 20;
    queryBuilder.offset = 0;


the result will be as expected

But we need to use Transaction to handle our case.

Hello @long_nguyen

Unfortunately, I couldn’t be able to reproduce this issue on my own app. Could you create a minimal reproducible example of that in your app(tables and data) and provide a code example where you trying to retrieve data? Also will be helpful if you provide an expected result of the operation too.

Regards, Dima.

@Dima I have created a minimal example here GitHub - longnguyen0410/test_retrieve_data. Can you check?
I have created 2 methods getCommentsUsingTransaction() & getCommentsWITHOUTTransaction() in main.dart to help you easy to compare results.

The result of getCommentsUsingTransaction is wrong sort, wrong offset of paging, and createdBy object is null.

The expected result is:(same as getCommentsWITHOUTTransaction() result)

hello @long_nguyen

Thank you for the project, I have created internal ticket BKNDLSS-30862 to investigate the issue

@Dima @sergey.kuk hello, do you have any progress on this issue?

Hello, @long_nguyen.

When the issue is fixed, we will notify you.

Best Regards, Nikita.

1 Like

@long_nguyen the problem has been fixed in version 7.2.10. Let us know if everything is now working as expected.

@Nikita_Fedorishchev it’s working as expected in version 7.2.10. Thank Flutter team :heart: