Filter Data Geodatabase

605
6
Jump to solution
12-26-2019 11:04 AM
jaykapalczynski
Frequent Contributor

I have a local .geodatabase on my mobile device.  I can read it fine. 

I am now attempting to set a where clause or filter that allows the user to click a button and filter / ONLY show data that is there based on the Created_User field

Can I just set a WHERE clause in the Geodatabase or do I nee to do something else...

I would like to be able to click the button to just show that specific persons from the field and then click the button again and go back to ALL data.

Thoughts?

                FeatureLayer {
                    id: Points
                    visible: false
                    featureTable: gdb.geodatabaseFeatureTablesByTableName["Hunting"]
                   
                    // create the geodatabase
                    Geodatabase {
                        id: gdb
                        path: Path
                        onErrorChanged: errorMessage = error.message;
                    }
                    onErrorChanged: errorMessage = error.message;
                }
0 Kudos
1 Solution

Accepted Solutions
ErwinSoekianto
Esri Regular Contributor

I would assume, it would be the same as how you would put the query parameter for the REST end point of the feature layer. Querying Feature Services: Date-Time Queries 

cc: ArcGIS Runtime SDK for Qt

View solution in original post

0 Kudos
6 Replies
jaykapalczynski
Frequent Contributor

Im trying this but not sure because I am using a local geodatabase and think my syntax might be incorrect

It removes all of the records when I click the button and then turns them all on 

BUT its removing them all and I know there are a couple different values in the created_user field.

thoughts?

                    Button {
                        text: "Apply Expression"
                        enabled: gdb.loadStatus === Enums.LoadStatusLoaded
                        onClicked: {
                            Points.definitionExpression = "created_user = \'ESRI_Anonymous\'"
                        }
                    }
                    Button {
                        text: "Reset"
                        enabled: gdb.loadStatus === Enums.LoadStatusLoaded
                        onClicked: {
                            Points.definitionExpression = "";
                        }
                    }
0 Kudos
jaykapalczynski
Frequent Contributor

Think I have it...just syntax...

what are the \ used in his example

Feature layer definition expression | ArcGIS for Developers 

How can I make a LIKE statement

onClicked: {
   Points.definitionExpression = "created_user = 'Law'"
 }


0 Kudos
jaykapalczynski
Frequent Contributor

Does this look correct?  Seems like I could make this look nicer but this seems to work.

"created_user = " + "'" + credentialUsersNameNew + "'" + " AND PublicPrivate = 'public'";


Last question....any idea how to query between specific dates?



0 Kudos
jaykapalczynski
Frequent Contributor

I am trying this but no luck

This is trying to query the created_date that is created automatically

var startdate = "12/18/2019 1:30:10 AM";

Points.definitionExpression = "created_date >= " + " ' " + startdate + " ' ";

Does a .geodatabase file follow SQL standards?

preferably I would simply like to query for a specific year....

i.e. show me the records for 2018 or 2019

0 Kudos
ErwinSoekianto
Esri Regular Contributor

I would assume, it would be the same as how you would put the query parameter for the REST end point of the feature layer. Querying Feature Services: Date-Time Queries 

cc: ArcGIS Runtime SDK for Qt

0 Kudos
jaykapalczynski
Frequent Contributor

OK great...yea wanted to know if it follow standard SQL....looks like it does....Cheers

0 Kudos