Unable to query using a pointer using Android SDK - parse-platform

I am trying to run a query using com.parse:parse-android:1.13.0 version of the parse android SDK. I am creating a query on the local storage and using ParseQuery$whereMatchesQuery() method to match a column storing pointer to another class in my database. The code that I have is the following:
ParseQuery<PracticeSessionDetails> query = ParseQuery.getQuery(PracticeSessionDetails.class);
query.fromLocalDatastore();
query.ignoreACLs();
query.whereEqualTo("user", ParseUser.getCurrentUser());
ParseQuery courseQuery = new ParseQuery("Course");
courseQuery.whereEqualTo("objectId",courseId);
query.whereMatchesQuery("course", courseQuery);
When I run the query using query.getFirst(), I do not get anything retrieved from the local storage. I have already checked running the courseQuery separately and it fetches me Course object that I need. Is this a known issue? I proceeded with this way by getting help from this post.

I think you are mixing query while storing pointer to another class in your database. Use following code to resolve your problem:
ParseQuery<PracticeSessionDetails> query = ParseQuery.getQuery(PracticeSessionDetails.class);
query.fromLocalDatastore();
query.ignoreACLs();
query.whereEqualTo("user", ParseUser.getCurrentUser());
ParseQuery<ParseObject> courseQuery = ParseQuery.getQuery("Course");
courseQuery.whereMatchesQuery("course", query);

Related

Calling a custom api via c# sdk

I have this custom api called "pits_PostProjectLineEntries" which takes in a EntityCollection called Transactions. I am using the option to have the entities in that EntityCollection to be expando since I really not need to create a table to hold this entities. I am able to call the custom api via PostMan with some raw json, and it works perfectly. My issue is when I use C# Plugins, I am getting errors messages about the entities logical name within Transactions collection. Is there a way to tell the Xrm SDK that these entities are not tied to a physical table but are just expando.
Here is the code that calls the Custom API for ref.
_transactions = new List<Entity>();
Entity Transaction = new Entity("");
Transaction["date"] = userReport.GetAttributeValue<DateTime>("pits_date");
Transaction["project"] = userReport.GetAttributeValue<EntityReference>("pits_project");
Transaction["resource"] = userReport.GetAttributeValue<EntityReference>("pits_user");
Transaction["task"] = userReport.GetAttributeValue<EntityReference>("pits_task");
Transaction["worktype"] = response["WorkType"];
Transaction["shifttype"] = response["ShiftType"];
Transaction["quantity"] = RG;
Transaction["chargeable"] = true;
Transaction["tx_type"] = 361200000;
_transactions.Add(Transaction);
EntityCollection Transactions = new EntityCollection(_transactions);
OrganizationRequest request = new OrganizationRequest("pits_PostProjectLineEntries");
request.Parameters.Add("Transactions", Transactions);
var response = _context.OrganizationService.Execute(request);
The error message I get is:
An unexpected error occurred: The entity with a name = '' with namemapping = 'Logical' was not found in the MetadataCache.
I am trying to call this custom api and pass it an entity that is tied to a DV Table from the C# sdk.
Sorry if the formatting is bad, I have been using stack overflow for a long time, but first time posting
This is a known bug with Expando entities in the currently shipping SDK assemblies, The Dataverse ServiceClient version (.net / cross platform) of the SDK should be working correctly at this time. You can get that here: https://www.nuget.org/packages/Microsoft.PowerPlatform.Dataverse.Client/
The libraries from Microsoft.CrmSdk.CoreAssemblies will have the fix on next update (at the time of this writing)

Object doesn't get updated after calling SaveAsync on Parse Unity 1.6.2

I have a column ("DataDict") storing type of Dictionary (let say the variable name is call "dataDict")
Recently I've updated to Parse Unity 1.6.2 and I found out that whenever I make an update to dataDict, it doesn't get updated to the server.
For example:
Dictionary<string, object> dict = ParseUser.CurrentUser["DataDict"] as Dictionary<string, object>;
dict["name"] = "something new";
// after I call ParseUser.CurrentUser.SaveAsync()
// the server should have updated the dictionary
// but it's no longer working as what I expected after I've updated to Parse 1.6.2
Does anyone know what's going on?
I noticed one of the keypoint that listed in the changelogs:
Removed 'mutable containers' functionality, significantly enhances performance.
Does this affected my codes? How should I fix it?
I've solved this by calling
ParseUser.CurrentUser["DataDict"] = dict;

Error: "include is invalid for non-ParseObjects" (using parse-osx-library-1.7.5)

I have a Meal object that stores pointers to n created objects "FoodInfo" using the key "MealItems".
When I query for the meal I take advantage of the [query includeKey:#"MealItems"] to fetch the items pointed to while fetching the "Meal".
This works swimmingly if the objects are created while online (ie. all are stored in the cloud db).
However, since I cannot assume access to the cloud at all time for this app I am now trying to enable the local datastore so I've changed my queries to use:
[query fromLocalDatastore];
and I've changed all of my objects' save methods to pinInBackgroundWithBlock followed by (assuming success of local save) saveInBackgroundWithBlock followed by (assuming failure) saveEventually.
To test this, I:
turned off wifi
ran the code to create a meal and then add newly created foods to it. This works with no error codes.
ran a report that then queries for the meal just created. This fails with the following:
Error: Error Domain=Parse Code=121
"include is invalid for non-ParseObjects" UserInfo=0x60800007f400 {
error=include is invalid for non-ParseObjects,
NSLocalizedDescription=include is invalid for non-ParseObjects,
code=121
} {
NSLocalizedDescription = "include is invalid for non-ParseObjects";
code = 121;
error = "include is invalid for non-ParseObjects";
}
Is this scenario not supported?
When I re-enable wifi, the meal is successfully added to the online db, but the query failure still happens when I run the query with the includeKey locally.
Am I missing something here? I'm quite surprised to see this failing. It seems like a really basic feature that should work whether local or cloud based.
Parse objects are not created until you save them. Try using saveEventually first before using pinInBackgroundWithBlock.

Trouble fetching JSONArray key from server

1) I have an Object (JB8XGctiZw) that has to keys: "patternName", and "tempoIntensities". When I run the following code, It will fetch the correct values of both keys.
ParseObject parseObject=ParseObject.createWithoutData("AudioPattern", "JB8XGctiZw");
parseObject=parseObject.fetch();
parseObject.pin();
Log.d("pattern",parseObject.getJSONArray("tempoIntensities").toString());
Log.d("pattern",parseObject.getString("patternName"));
2) From the web interface I change value contents for BOTH keys.
3) Run again the above code and it will successfully bring me the new value for "patterName", but "tempoIntensities", the JSONArray, will not be updated.
The only way to get the JSONArray updated is to clear local storage.
Is this a bug? Is this behavior normal?
Regards
It seems to be an issue with using ParseObject.getJSONArray and ParseObject.getJSONObject. For the moment I fixed this using ParseObject.get() and then casting it.
The version of Parse this applies to is 1.8.2,
And there is an assigned issue here:
https://developers.facebook.com/bugs/846833412048862/
You should be logged in to facebook to see this bug

No signature of method: groovy.lang.MissingMethodException.makeKey()

I've installed titan-0.5.0-hadoop2 with hbase and elasticsearch support
I've loaded the graph with
g = TitanFactory.open('conf/titan-hbase-es.properties')
==>titangraph[hbase:[127.0.0.1]]
and a then I loaded the test application
GraphOfTheGodsFactory.load(g)
Now when I'm trying to create a new index key with:
g.makeKey('userId').dataType(String.class).indexed(Vertex.class).unique().make()
and I got this error:
No signature of method: groovy.lang.MissingMethodException.makeKey() is applicable for argument types: () values: []
Possible solutions: every(), any()
Display stack trace? [yN]
Can someone help me with this ?
when I want to see the indexed keys I see this
g.getIndexedKeys(Vertex.class)
==>reason
==>age
==>name
==>place
I'm not completely following what you are trying to do. It appears that you loaded Graph of the Gods to g and then you want to add userId as a new property to the schema. If that's right, then i think your syntax is wrong, given the Titan 0.5 API. The method for managing the schema is very different from previous versions. Changes to the schema are performed through the ManagementSystem interface which you can get an instance of through:
mgmt = g.getManagementSystem()
The syntax for adding a property then looks something like:
birthDate = mgmt.makePropertyKey('birthDate').dataType(Long.class).cardinality(Cardinality.SINGLE).make()
mgmt.commit()
Note that g.getIndexKeys(Class) is not the appropriate way to get schema information either. You should use the ManagementSystem for that too.
Please see the documentation here for more information.

Resources