Not getting property from user table

latest Backendless , using java

this is my code but getting null, while in backendless it’s working :(:
if (!Backendless.UserService.isValidLogin()) {return;}
BackendlessUser user = Backendless.UserService.CurrentUser();

    DataQueryBuilder query = DataQueryBuilder.create();
    query.setPageSize(100);
    query.addRelated("stores");
    try {
        query.setWhereClause("objectId='" + user.getObjectId() + "'");
        Log.e("sql", "getStoreList: objectId='"+user.getObjectId()+"'");
    } catch (Exception e) {
        Toast.makeText(MainActivity.context, "err", Toast.LENGTH_SHORT).show();
        Log.e("err", "getStoreList: " + e.getMessage());
    }


    //Stores userStores =(Stores) user.getProperty("stores");

    Backendless.Data.of("Users").find(query, new AsyncCallback<List<Map>>() {
        @Override
        public void handleResponse(List<Map> response) {
            storeNames = new ArrayList<>();
            try {
                HashMap[] userStores = (HashMap[]) response.get(0).get("stores");
                for (int counter = 0; counter < userStores.length; counter++) {
                    com.befood.app.backendless.StoreList newStore = new com.befood.app.backendless.StoreList((String) userStores[counter].get("storeName"),
                            (String) userStores[counter].get("storeImage"),
                            (String) userStores[counter].get("objectId"),
                            (String) userStores[counter].get("storeGPS"));
                    storeNames.add(newStore);
                }
            } catch (Exception e) {
                Log.e("err", "handleResponse: no stores");
            }


            if (storeNames.size() < 1) {
                findViewById(R.id.imgStores).setVisibility(View.VISIBLE);
                return;
            }
            findViewById(R.id.imgStores).setVisibility(View.INVISIBLE);
            StoreManageListAdapter adapter = new StoreManageListAdapter(context, storeNames);
            lstUserStores.setAdapter(adapter);


        }

        @Override
        public void handleFault(BackendlessFault fault) {
            Toast.makeText(MainActivity.context, "err", Toast.LENGTH_SHORT).show();
            Log.e("err", "handleFault: " + fault.getMessage());
        }
    });

What property is not being returned?

Stores, which is table related.
Worked before.
I getting only regular properties and not see the stores field

Hello @zeev-mindali,

We will be happy to assist you. I need to ask you a few more questions so I can reproduce the problem.

What is your application id?
What version of sdk do you use?

app id: 066298BB-F6FE-A1C0-FF44-76C4C0C15700
sdk : 6.0.1

updated to 6.1.2,
same problem :frowning:

rest console also not showing the stores column :frowning:
[
{
“birtrhDay”: null,
“image”: “na”,
“lastLogin”: 1605618944000,
“userStatus”: “ENABLED”,
“device_id”: “78cdb6eae01201da”,
“created”: 1605543067000,
“last_name”: null,
“ownerId”: “8DE209DF-FE23-453C-A4CB-FB422DD0CEC9”,
“socialAccount”: “BACKENDLESS”,
“user_add”: null,
“userAgree”: false,
“phone”: “na”,
“name”: “emulator 711”,
“___class”: “Users”,
“blUserLocale”: “en”,
“updated”: 1605543324000,
“first_name”: null,
“email”: “changeme@befood.com”,
“objectId”: “8DE209DF-FE23-453C-A4CB-FB422DD0CEC9”
}
]

@zeev-mindali I have tried your code and it works:

public static void main( String[] args )
  {
    Backendless.initApp( "app-id", "api-key" );
    DataQueryBuilder query = DataQueryBuilder.create();
    query.setPageSize( 100 );
    query.addRelated( "stores" );

    query.setWhereClause( "objectId='5BEEEDA9-3CC8-4046-8E00-FE624192DD32'" );

    Backendless.Data.of( "Users" ).find( query, new AsyncCallback<List<Map>>()
    {
      @Override
      public void handleResponse( List<Map> response )
      {
        try
        {
          HashMap[] userStores = (HashMap[]) response.get( 0 ).get( "stores" );
          for( int counter = 0; counter < userStores.length; counter++ )
          {
            System.out.println( userStores[ counter ] );
          }
        }
        catch( Exception e )
        {
        }
      }

      @Override
      public void handleFault( BackendlessFault fault )
      {
        System.out.println( fault );
      }
    } );
  }

The result of execution is:

{storeImage=https://backendlessappcontent.com/066298BB-F6FE-A1C0-FF44-76C4C0C15700/<apikey>/files/storesImages/e7085c85-b528-49e5-aa1b-4f32c9b2137f, taarifC_range=0, tueOpen=10:00, wedOpen=10:00, monClose=23:59, wedClose=23:59, satClose=23:59, thuOpen=10:00, ownerId=5BEEEDA9-3CC8-4046-8E00-FE624192DD32, storeGPS=33.0505543,35.3096893, monOpen=1000, eta=0, friIsOpen=true, friClose=23:59, TaarifC=0, minimumOrder=0, ___class=stores, nighShift=false, rank=0, TarrifA=0, TaarifB=0, tel=96436897, storeName=sharef, objectId=780920F2-BCF2-45F5-AAEB-2632518D8082, sunIsOpen=false, isRecommnded=false, taarifB_range=0, created=Wed Oct 14 22:34:08 EEST 2020, tueClose=23:59, maxDistance=0, nightShiftCost=0, satOpen=00:00, wedIsOpen=true, thuClose=23:59, sunOpen=00:00, sunClose=23:59, thuIsOpen=true, satIsOpen=true, tueIsOpen=true, friOpen=00:00, isEnabled=false, taarifA_range=0, updated=Wed Oct 14 22:39:07 EEST 2020, monIsOpen=true}
{storeImage=https://backendlessappcontent.com/066298BB-F6FE-A1C0-FF44-76C4C0C15700/<apikey>/files/storesImages/e125bd2d-f756-40cb-a6fe-6c8ed26c12e6, taarifC_range=0, tueOpen=00:00, wedOpen=00:00, monClose=23:59, wedClose=23:59, satClose=21:59, thuOpen=00:00, ownerId=5BEEEDA9-3CC8-4046-8E00-FE624192DD32, storeGPS=33.0504089,35.3094607, monOpen=00:00, eta=0, friIsOpen=true, friClose=21:59, TaarifC=0, minimumOrder=0, ___class=stores, nighShift=false, rank=0, TarrifA=0, TaarifB=0, tel=0508837774, storeName=Taboon albld, objectId=780F65C1-70BF-430E-A4F7-F23871C82D5D, sunIsOpen=false, isRecommnded=false, taarifB_range=0, created=Fri Oct 16 19:05:23 EEST 2020, tueClose=23:59, maxDistance=0, nightShiftCost=0, satOpen=09:00, wedIsOpen=true, thuClose=23:59, sunOpen=00:00, sunClose=23:59, thuIsOpen=true, satIsOpen=true, tueIsOpen=true, friOpen=09:00, isEnabled=false, taarifA_range=0, updated=Fri Oct 16 19:08:50 EEST 2020, monIsOpen=true}
{storeImage=https://backendlessappcontent.com/066298BB-F6FE-A1C0-FF44-76C4C0C15700/<apikey>/files/storesImages/ee520fb7-6a3d-409b-a21f-b39c2f7ac2eb, taarifC_range=0, tueOpen=00:00, wedOpen=00:00, monClose=23:59, wedClose=23:59, satClose=23:59, thuOpen=00:00, ownerId=5BEEEDA9-3CC8-4046-8E00-FE624192DD32, storeGPS=33.0502742,35.3094273, monOpen=00:00, eta=0, friIsOpen=false, friClose=23:59, TaarifC=0, minimumOrder=0, ___class=stores, nighShift=false, rank=0, TarrifA=0, TaarifB=0, tel=0509877798, storeName=fassouta like, objectId=8AD1306F-2FB6-4D12-8044-F3FB925D0D1D, sunIsOpen=false, isRecommnded=false, taarifB_range=0, created=Sun Sep 13 18:15:54 EEST 2020, tueClose=23:59, maxDistance=0, nightShiftCost=0, satOpen=00:00, wedIsOpen=false, thuClose=23:59, sunOpen=00:00, sunClose=23:59, thuIsOpen=false, satIsOpen=false, tueIsOpen=false, friOpen=00:00, isEnabled=false, taarifA_range=0, updated=null, monIsOpen=false}
{storeImage=https://backendlessappcontent.com/066298BB-F6FE-A1C0-FF44-76C4C0C15700/<apikey>/files/storesImages/cecc7b81-5f7b-4755-a505-b4ff1cb094f1, taarifC_range=0, tueOpen=00:00, wedOpen=00:00, monClose=23:59, wedClose=23:59, satClose=23:59, thuOpen=00:00, ownerId=5BEEEDA9-3CC8-4046-8E00-FE624192DD32, storeGPS=33.0189242,35.2708724, monOpen=00:00, eta=0, friIsOpen=true, friClose=23:59, TaarifC=0, minimumOrder=0, ___class=stores, nighShift=false, rank=0, TarrifA=0, TaarifB=0, tel=0507777444, storeName=smiley, objectId=A800C9CF-3CED-4BB4-B7E6-40DA74D51B1B, sunIsOpen=true, isRecommnded=false, taarifB_range=0, created=Sun Sep 13 09:00:32 EEST 2020, tueClose=23:59, maxDistance=0, nightShiftCost=0, satOpen=00:00, wedIsOpen=true, thuClose=23:59, sunOpen=00:00, sunClose=23:59, thuIsOpen=true, satIsOpen=true, tueIsOpen=true, friOpen=00:00, isEnabled=false, taarifA_range=0, updated=Sun Sep 13 09:05:28 EEST 2020, monIsOpen=true}

going to try the excet code.
why I can not get the property directly from Backendless.UserService.CurrentUser.getProperty(“stores”)

CurrentUser contains logged in user, during login we do not load relations

not working :frowning:

I tried also via rest console, same thing

do I need to make initapp on each screen?

not working :frowning:
I tried also via rest console, same thing

have you tried the following curl:

curl 'https://api.backendless.com/066298BB-F6FE-A1C0-FF44-76C4C0C15700/<your-api-key>/data/Users?loadRelations=stores'

?

curl is workin
but I need it in android, don’t want json format

I have generated CRUD from your app, added the code there and everything works. I have uploaded the example that shows it https://develop.backendless.com/jibly/files/example

src/com/sample/api/DemoComment.java

contains your code
if you run the example you will see store in the logcat

I got lost,
in first activity and after login, etc… it’s working
once I getting to third screen from the main, there are no response , not from users or any table in the system.
this is strange, I looked on the software, all was working, I don’t getting to the problem of it
don’t know what to do next,
make another app.init? user login? I got lost

Sounds like it is going to be debugging time for you… :wink:

when you coming to Israel, I must give you some food, really :slight_smile:

I tried to debug, the strange thing I encounter.
Current user, is ok, and user login is valid
I even take out the query, to get a data, any data, something
but nada, response stay null

I will be coming as soon as the pandemic is over. Get that shakshuka ready!

As for the code, the API is working, we have validated it multiple times. There must be something in your code that messes it up.

yeah, tell me about it :frowning: