Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

equalTo() is not working when we have two conditions on the same field #7891

Open
sanjoytech4 opened this issue May 23, 2024 · 6 comments
Open

Comments

@sanjoytech4
Copy link

How frequently does the bug occur?

Always

Description

We have a type field. We need the list of data from DB where (type == "ABSENCE" or type == " PUBLIC_HOLIDAY"). But we are getting data of type == "ABSENCE" only

val query = realm.where(TimeOffEvents::class.java)
        val iterator = types.split(",").toTypedArray()
        query.equalTo("type", iterator[0]).or().equalTo("type", iterator[1])
        query.sort("startDate", Sort.ASCENDING).findAllAsync()

Stacktrace & log output

No response

Can you reproduce the bug?

Always

Reproduction Steps

No response

Version

10.17.0

What Atlas App Services are you using?

Local Database only

Are you using encryption?

No

Platform OS and version(s)

Android

Build environment

Android Studio version: Android Studio Jellyfish | 2023.3.1 Patch 1
Android Build Tools version: ...
Gradle version: 8.2.2

Copy link

sync-by-unito bot commented May 23, 2024

➤ PM Bot commented:

Jira ticket: RJAVA-1262

@kneth
Copy link
Contributor

kneth commented May 23, 2024

Just to get a better understanding - in the following code snippet, results will not contain the PUBLIC_HOLIDAY entries?

val query = realm.where(TimeOffEvents::class.java)
val iterator = types.split(",").toTypedArray()
val results: RealmResults<TimeOffEvent> =   query.equalTo("type", iterator[0]).or().equalTo("type", iterator[1]).sort("startDate", Sort.ASCENDING).findAll()

@sync-by-unito sync-by-unito bot added the Waiting-For-Reporter Waiting for more information from the reporter before we can proceed label May 23, 2024
@sanjoytech4
Copy link
Author

sanjoytech4 commented May 23, 2024

@kneth Yes, results do not contain the PUBLIC_HOLIDAY entries.

@github-actions github-actions bot added Needs-Attention and removed Waiting-For-Reporter Waiting for more information from the reporter before we can proceed labels May 23, 2024
@kneth
Copy link
Contributor

kneth commented May 23, 2024

@sanjoytech4 Please provide more information e.g., the exact value of types and the TimeOffEvent class.

@sync-by-unito sync-by-unito bot added Waiting-For-Reporter Waiting for more information from the reporter before we can proceed and removed Needs-Attention labels May 23, 2024
@sanjoytech4
Copy link
Author

@kneth
Here is TimeOffEvents class & type Value could be ABSENCE, PUBLIC_HOLIDAY, NON_WORKING_DAY

open class TimeOffEvents : RealmObject() {
    var externalCode: String? = ""
    var title: String? = ""
    var startDate: Date? = null
    var endDate: Date? = null
    var startTime: String? = ""
    var endTime: String? = ""
    var duration: Double = 0.0
    var timeUnit: String? = ""
    var durationFormatted: String? = ""
    var crossMidnight: Boolean = false
    var type: String? = ""
}

@github-actions github-actions bot added Needs-Attention and removed Waiting-For-Reporter Waiting for more information from the reporter before we can proceed labels May 23, 2024
@sanjoytech4
Copy link
Author

@kneth Any update on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants