I'm sure this is going to be a long shot, but I need help with a query involving QuickBooks Items.
I need to query for all QuickBooks Items that are linked to an Income account. Is there an easy way to do this, or do I need to make 2 queries (one for items ans one for accounts) and then check the account reference?
albeit not much, I have this:
IItemQuery query = MsgSetRequest.AppendItemQueryRq();
any ideas would be appreciated. Thanks.
You need to use at least two queries. You'll need to fetch a list of accounts, and then compare the items AccountRef FullName to the income accounts in the list.
Using the XML, at least, if you query all items you can get back the accounts of all of them, and filter for the account that you want. The full name of the account will be included in the item query response if you specifically ask for it in IncludeRetElement.
Related
I'm looking to build an app that functions like a dating app:
User A fetches All Users.
User A removes Users B, C, and D.
User A fetches All Users again - excluding Users B, C, and D.
My goal is to perform a query that does not read the User B, C, and D documents in my fetch query.
I've read into array-contains-any, array-contains, not-in queries, but the 10 item limit prevents me from using these as options because the "removed users list" will continue to grow.
2 workaround options I've mulled over are...
Performing a paginated fetch on All User documents and then filtering out on the client side?
Store all User IDs (A, B, C, D) on 1 document in an array field, fetch the 1 document, and then filter client side?
Any guidance would be extremely appreciated either on suggestions around how I store my data or specific queries I can perform.
You can do it the other way around.
Instead of a removed or ignored array at your current user, you have an array of ignoredBy or removedBy in which you add your current user.
And when you fetch the users from the users collection, you just have to check if the requesting user is part of the array ignoredBy. So you don’t have tons of entries to check in the array, it is always just one.
Firestore may get a little pricey with the Tinder model but you can certainly implement a very extensible architecture, well enough to scale to millions of users, without breaking a sweat. So the user queries a pool of people, and each person is represented by their own document, this much is obvious. The user must then take an action on each person/document, and, presumably, when an action is taken that person should no longer reappear in the user's queries. We obviously can't edit the queried documents because there could be millions of users and that wouldn't scale. And we shouldn't use arrays because documents have byte limits and that also wouldn't scale. So we have to treat a collection like an array, using documents as items, because collections have no known limit to how many documents they can contain.
So when the user takes an action on someone, consider creating a new document in a subcollection in the user's own document (user A, the one performing the query) that contains the person's uid, and perhaps a boolean to determine if they liked or disliked that person (i.e. liked: true), and maybe a timestamp for UI purposes. This new document is the item in your limitless array.
When the user later performs another query, those same users are going to reappear in the results, which you need to filter out. You have no choice but to check if each person's uid is in this subcollection. If it is, omit the document and move to the next. But if your UI is configured like Tinder's, where there isn't a list of people to scroll through but instead cards stacked on top of each other, this is no big deal. The user will only be presented with one person at a time and they won't know how many you're filtering out behind the scenes. With a paginated list, the user may see odd behavior like uneven pages. The drawback is that you're now paying double for each query. Each query will cost you the original fetch and the subcollection-check fetch. But, hey, with this model you can scale to millions of users without ever breaking a sweat.
i have a graph database and i am trying to find out which team has the most and the least shots in the season. i got until this pointenter image description here
Could you give me some hints how to find out the number of shots?
There is a problem with design . Ideally, You have to give common label(like "Team") for all the teams . And relation with event anyway can help in finding which is away team and which is home team and number of shots can be a property in the relation.
i would like to know if there are multiple nodes for same team in your graph to help you in this case.
You could use ORDER BY keyword to sort by shots, e.g.
RETURN a.away_shorts, m.away_team, m.home_team, b.home_shots
ORDER BY a.away_shots
//sort by order ascending, use ORDER BY a.away_shots DESC to reverse
If you wanted to only return the first team with, for example the least away shots, you might do something like this:
MATCH (a.AwayTeam)-[:PLAYED_AWAY]->(m:Event)<-[:PLAYED_HOME]-(b:HomeTeam)
RETURN a.away_shots, m.away_team, m.home_team, b.home_shots
ORDER BY a.away_shots LIMIT 1
When i try to query this " Select Name from CompanyCurrency" i get this error
Error
And If i Query by Code i get a result like this (Select Code from CompanyCurrency):
Results by selecting the name
Well , i don't know why is this happening because both code and name are properties in the table , any way i wanted to skip this issue by searching on the code so i've did the search query using like operator and it faults even the same query on all the other tables on the quickbooks online works fine .
any one knows the issue that related with this table ?
I don't think you can filter the results of that query. Looking at the Manage multiple currencies docs like they do on other endpoints, it doesn't list any fields as filterable. You should retrieve the list and just select the one you need in your code.
Hi I am working on a social project that need to show a user's followers and following. And I am using the AnyPic project as example https://parse.com/tutorials. In Anypic example, showing number of followers is easy. You just need to get a list of followers of a user and count how many are there. But my question is what if there are 500K or 1M followers, will this approach be slow? Or should we do something different.
For example, we will still follow the anyPic example and have a class(or table) to record who is following who. And at the same time, we have an Integer column called "Number of Followers" in the user table. Everything a user follows userA, we will increment UserA's "Number of Followers". So whenever we need to know the number of followers of UserA, we can simply look at the "Number of Followers" column. But I prefer not to do it this way seems it adds some extra complexity.
Please let me know what you think about this. Or maybe Parse is so fast and powerful that I just don't need to worry about this issue at all.
I've learned with Parse: some times the "dirty way" is the best choise. Do you know "Parse cloudCode"? Just use afterSave function to increment the number of followers.
Ps.: Choose your best strategy (Join Table or Parse Relation) based on Parse information: https://parse.com/docs/relations_guide#manytomany
I'm trying to build a (simple) twitter-clone which uses CouchDB as Database-Backend.
Because of its reduced feature set, I'm almost finished with coding, but there's one thing left I can't solve with CouchDB - the per user timeline.
As with twitter, the per user timeline should show the tweets of all people I'm following, in a chronological order. With SQL it's a quite simple Select-Statement, but I don't know how to reproduce this with CouchDBs Map/Reduce.
Here's the SQL-Statement I would use with an RDBMS:
SELECT * FROM tweets WHERE user_id IN [1,5,20,33,...] ORDER BY created_at DESC;
CouchDB schema details
user-schema:
{
_id:xxxxxxx,
_rev:yyyyyy,
"type":"user",
"user_id":1,
"username":"john",
...
}
tweet-schema:
{
"_id":"xxxx",
"_rev":"yyyy",
"type":"tweet",
"text":"Sample Text",
"user_id":1,
...
"created_at":"2011-10-17 10:21:36 +000"
}
With view collations it's quite simple to query CouchDB for a list of "all tweets with user_id = 1 ordered chronologically".
But how do I retrieve a list of "all tweets which belongs to the users with the ID 1,2,3,... ordered chronologically"? Do I need another schema for my application?
The best way of doing this would be to save the created_at as a timestamp and then create a view, and map all tweets to the user_id:
function(doc){
if(doc.type == 'tweet'){
emit(doc.user_id, doc);
}
}
Then query the view with the user id's as keys, and in your application sort them however you want(most have a sort method for arrays).
Edited one last time - Was trying to make it all in couchDB... see revisions :)
Is that a CouchDB-only app? Or do you use something in between for additional buisness logic. In the latter case, you could achieve this by running multiple queries.
This might include merging different views. Another approach would be to add a list of "private readers" for each tweet. It allows user-specific (partial) views, but also introduces the complexity of adding the list of readers for each new tweet, or even updating the list in case of new followers or unfollow operations.
It's important to think of possible operations and their frequencies. So when you're mostly generating lists of tweets, it's better to shift the complexity into the way how to integrate the reader information into your documents (i.e. integrating the readers into your tweet doc) and then easily build efficient view indices.
If you have many changes to your data, it's better to design your database not to update too many existing documents at the same time. Instead, try to add data by adding new documents and aggregate via complex views.
But you have shown an edge case where the simple (1-dimensional) list-based index is not enough. You'd actually need secondary indices to filter by time and user-ids (given that fact that you also need partial ranges for both). But this not possible in CouchDB, so you need to work around by shifting "query" data into your docs and use them when building the view.