Somehow I couldn't find the answer to this.
I am running a query to parse.com and want to download all of the rows that contain an empty value in one of my columns.
ParseQuery<ParseObject> query = ParseQuery.getQuery(Constants.myTestTable);
query.whereEqualTo("MyColumn", "");
When I upload a csv to parse where MyColumn does not have any value the column cells on parse show "(undefined)" and I cannot retrieve the data. However, when I delete all content in the cell I am able to retrieve it. I want to be able to retrieve the data if the cell has the default "(undefined)" value from parse. I tried...
ParseQuery<ParseObject> query = ParseQuery.getQuery(Constants.myTestTable);
query.whereEqualTo("MyColumn", null);
But that did not work either. I'm sure there is an easy solution to this, I just can't get the dang thing to work.
What you want are whereExists and whereDoesNotExist.
query.whereDoesNotExist("MyColumn");
Related
I'm trying to run a query on my firebase database in order to return only those results where timestamp = the date specified in the date picker (see picture of app) I want this query to run whenever I press the view records button
[![Firebase][3]][3]
I am able currently to print out all objects into the recycler view, however when attempting to run my query its not producing any results, no errors and no faults in debugging
If I need to provide anymore detail please let me know
[3]: https://i.stack.imgur.com/d2uu2.png
To solve this, please change the following line of code:
options = new FirebaseRecyclerOptions.Builder<Records>().setQuery(databaseReference, Records.class).build();
to
options = new FirebaseRecyclerOptions.Builder<Records>().setQuery(query, Records.class).build();
// ^ ^
You have to pass to the setQuery() method the query object and not the databaseReference object because the query object actually filters your data.
Edit:
According to your comment:
Yep its working when hardcoded, but it's not working when getting the text view to string
This means that passing the query object did the trick but the problem remains on how you convert the data to String. To sovle this, be sure that the String representation of the date is of type: 04-02-2017 and your problem will be solved.
I'm new to couchbase. I'm using Java for this. I'm trying to remove a document from a bucket by looking up its ID with query parameters(assuming the ID is unknown).
Lets say I have a bucket called test-data. In that bucked I have a document with ID of 555 and Content of {"name":"bob","num":"10"}
I want to be able to remove that document by querying using 'name' and 'num'.
So far I have this (hardcoded):
String statement = "SELECT META(`test-data`).id from `test-data` WHERE name = \"bob\" and num = \"10\"";
N1qlQuery query = N1qlQuery.simple(statement);
N1qlQueryResult result = bucket.query(query);
List<N1qlQueryRow> row = result.allRows();
N1qlQueryRow res1 = row.get(0);
System.out.println(res1);
//output: {"id":"555"}
So I'm getting a json that has the document's ID in it. What would be the best way to extract that ID so that I can then remove the queryed document from the bucket using its ID? Am I doing to many steps? Is there a better way to extract the document's ID?
bucket.remove(docID)
Ideally I'd like to use something like a N1q1QueryResult to get this going but I'm not sure how to set that up.
N1qlQueryResult result = bucket.query(select("META.id").fromCurrentBucket().where((x("num").eq("\""+num+"\"")).and(x("name").eq("\""+name+"\""))));
But that isn't working at the moment.
Any help or direction would be appreciated. Thanks.
There might be a better way which is running this kind of query:
delete from `test-data` use keys '00000874a09e749ab6f199c0622c5cb0' returning raw META(`test-data`).id
or if your fields has index:
delete from `test-data` where name='bob' and num='10' returning raw META(`test-data`).id
This query deletes the specified document with given document key (which is meta.id) and returns document id of deleted document if it deletes any document. Returns empty if no documents deleted.
You can implement this query with couchbase sdk as follows:
Statement statement = deleteFrom("test-data")
.where(x("name").eq(s("bob")).and(x("num").eq(s("10"))))
.returningRaw(meta(i("test-data")).get("id"));
You can make this statement parameterized or just execute like that.
I'm trying to add a search ListView with Parse api. But I could not add can anyone tell me how to add it ? (It is a typical ListView just fetching some text from parse).
Try the parse query adapter. It's an easy adapter for getting parse queries into a list.
If you want to filter a query you have already pulled from the server then you could save all the results to the local datastore and then query that to save the amount of downloads required.
https://github.com/ParsePlatform/ParseUI-Android/wiki/ParseQueryAdapter
I am trying to print all users I have saved on Parse database on my screen. But somehow it doesn't work, I can print the data from all other tables expect the users...
I think the problem is somewhere here, because when I change the "Todo" to User table it doesn't work anymore...
mainAdapter = new ParseQueryAdapter<ParseObject>(this, "Todo");
mainAdapter.setTextKey("title");
any suggestions? Thanks!
The user class is special (so are a couple of others) because it's built into the platform. The name doesn't work because the name is private. As you can see _Users is the private name, but you shouldn't use it - you can't guarantee it won't change. The correct way to query is:
ParseQuery<ParseUser> query = ParseUser.getQuery();
I have been trying to retrieve information from querying a specific Asset(Story/Defect) on V1 using the VersionOne.SDK.Java.APIClient. I have been able to retrieve information like ID.Number, Status.Name but not Requests.Custom_SFDCChangeReqID2 under a Story or a Defect.
I check the metadata for:
https://.../Story?xsl=api.xsl
https://.../meta.V1/Defect?xsl=api.xsl
https://.../meta.V1/Request?xsl=api.xsl
And the naming and information looks right.
Here is my code:
IAssetType type = metaModel.getAssetType("Story");
IAttributeDefinition requestCRIDAttribute = type.getAttributeDefinition("Requests.Custom_SFDCChangeReqID2");
IAttributeDefinition idNumberAttribute = type.getAttributeDefinition("ID.Number")
Query query = new Query(type);
query.getSelection().add(requestCRIDAttribute);
query.getSelection().add(idNumberAttribute);
Asset[] results = v1Api.retrieve(query).getAssets();
String RequestCRID= result.getAttribute(requestCRIDAttribute).getValue().toString();
String IdNumber= result.getAttribute(idNumberAttribute).getValue().toString();
At this point, I can get some values for ID.Number but I am not able to retrieving any information for the value Custom_SFDCChangeReqID2.
When I run the restful query to retrieve information using a browser from a server standpoint it works and it does retrieve the information I am looking for. I used this syntax:
https://.../rest-1.v1/Data/Story?sel=Number,ID,Story.Requests.Custom_SFDCChangeReqID2,Story.
Alex: Remember that Results is an array of Asset´s, so I guess you should be accessing the information using something like
String RequestCRID= results[0].getAttribute(requestCRIDAttribute).getValue().toString();
String IdNumber= results[0].getAttribute(idNumberAttribute).getValue().toString();
or Iterate through the array.
Also notice that you have defined:
Asset[] results and not result
Hi thanks for your answer! I completely forgot about representing the loop, I was too focus on the retriving information part, yes I was actually using a loop and yes I created a temporary variable to check what I was getting from the query in the form
Because I was getting the variables one by one so I was only using the first record. My code works after all. It was just that What I was querying didn't contain any information of my use, that's why I was not finding any. Anyway thanks for your comment and observations