Support Topics Documentation Slack YouTube Blog

Getting objectId from search with whereClause

So I’m trying to add a user to a group that’s already in the database, I’m trying to search for this group by his inviteId. I’ve setted my whereClause to match the input inviteId. But has I run Backendless.Data.of(“Group”).find(queryBuilder), where it should find me the group, It is saving it has a List.

btnJoinGroup.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (etGroupId.getText().toString().isEmpty()) {
                    Toast.makeText(FirstGroup.this, "Invite EMPTY!", Toast.LENGTH_SHORT).show();
                } else {
                    String groupInviteId = etGroupId.getText().toString().trim();

                    String whereClause = "inviteId = " + groupInviteId;
                    DataQueryBuilder queryBuilder = DataQueryBuilder.create();
                    queryBuilder.setWhereClause(whereClause);

                    List<Map> result = Backendless.Data.of("Group").find(queryBuilder);
                    
                }

            }
        });
    }

How can I get the objectId of the searched group?

Hi Alexandre

Just get the first item of “result” List and then get “objectId” of the item

Regards, Vlad