B4J Question DBUtils And operator

Subatanx86

Member
Licensed User
Is it possible to use the And operator to set two conditions for WhereFields that must be true to update a DBUtils record? I'm sure I'm wording this poorly. Below is an example of what I want to do, but it obviously doesn't work.


B4X:
Dim WhereFields As Map
    WhereFields.Initialize
    WhereFields.Put("Badge", txtBadge.text) AND WhereFields.Put("Status", "out")
    DBUtils.UpdateRecord(sql1, "People", "DateOut", DateTime.Date(DateTime.Now), WhereFields)
 

OliverA

Expert
Licensed User
The WhereFields are ANDed
B4X:
Dim WhereFields As Map
WhereFields.Initialize
WhereFields.Put("Badge", txtBadge.text)
WhereFields.Put("Status", "out")
DBUtils.UpdateRecord(sql1, "People", "DateOut", DateTime.Date(DateTime.Now), WhereFields)

The update will only happen on records where Badge = txtBadge.text AND Status = "out"
 
Upvote 1

Subatanx86

Member
Licensed User
The WhereFields are ANDed
B4X:
Dim WhereFields As Map
WhereFields.Initialize
WhereFields.Put("Badge", txtBadge.text)
WhereFields.Put("Status", "out")
DBUtils.UpdateRecord(sql1, "People", "DateOut", DateTime.Date(DateTime.Now), WhereFields)

The update will only happen on records where Badge = txtBadge.text AND Status = "out"
Interesting I'm not getting the results I'm expecting. I'll look to see if I made an error somewhere else.
 
Upvote 0
Top