How to access items sold from Square POS Transactions? - square-connect

I am trying to build a reporting script that GETs the sales from a particular period in our retail location and is able to access the "line items sold" data of each transaction.
Unfortunately, it looks like the "transaction" object does not have any line items associate with it nor does it contain an associated order id.
How can I view each transaction and its corresponding line items?

You can use SearchOrders to query for orders which have itemized items in the each order.

Related

Where can I find sold item notes in the Square API?

I'm trying to create a report to pull my Square POS transaction data into Excel through Power Query. Basically, I want the information available in the standard "Items Detail CSV" report found in the Square Dashboard, but connected to Excel so I can build custom reporting and update it any time with a refresh.
I can connect to the Square data in Excel no problem. What I'm having trouble with is finding the right data, specifically the notes the merchant can enter in during the time of sale about the item. We have several items that will come up as "Custom Amount" where we enter additional notes about the item, and I can't find the notes field through the API.
After looking through the documentation, I've tried two main queries:
The Transactions List from v2:
https://connect.squareup.com/v2/locations/{location_id}/transactions
The Payments List from v1:
https://connect.squareup.com/v1/{location_id}/payments
The Payments List includes the v1PaymentItemization data type, which should include the notes field defined as "Notes entered by the merchant about the item at the time of payment, if any." I assume that's what I'm looking for.
(Link to documentation: https://docs.connect.squareup.com/api/connect/v1#type-v1paymentitemization)
However, I cannot find the notes field anywhere in my pulled results. There are no error messages, and I see every data field listed in the v1PaymentItemization documentation except "notes" in my query results.
Edit: The notes we're using are on individual items, not the payment as a whole. This fits the description of V1 List Payments -> PaymentItemization -> notes. I did check the tender notes as mentioned in the comments, but this was not what I'm looking for. Until now, I wasn't aware we could make a comment on the transaction as a whole, as opposed to individual items. The individual items notes would be more helpful anyway.
Either way, I didn't find the tender notes in the pulled data either. Most of the fields are there in the data pull, but not notes, v1TenderEntryMethod, and a couple of others. There's actually more data available in the standard dashboard reports than is actually pulling from the API.
I do realize a workaround is to export the Item Detail CSV report from the Square Dashboard, and then manipulate the data in Excel from there. I could even have a connection to the folder or file where I save my exports. It's just not as smooth as the desired result of opening Excel, setting my parameters there, and clicking refresh to get the data and formatted report all in one place.
Thanks
Second Edit: In the POS, I'm entering an amount which shows up as Custom Amount in the itemized list for the sale. I then click on the Custom Amount to add a note to it and specify what the item is (e.g., "Lamp"). That note is applied to a single item, and there may be several items per transaction that have these notes added to them which would otherwise only show as "Custom Amount" on a report or receipt. We do this because we sell several items that are not standard inventory items, but we do want to keep track of what we've sold.
I can see these notes for each item in the standard reporting, so I know the data is entered and saved correctly. However, I can't find the note field when I pull from the API. I see all of the other itemization fields (i.e., name, quantity, item_detail, itemization_type, etc.), but not the note field.
I'm getting these results with a simple /v1/payments pull with no parameters or filters.

Need help in choosing right caching strategy

We car planning to store prices data to Memcache. prices are subject to car variant and location(city). This is how it is stored in the database.
variant, city, price
21, 48, 40000
Now the confusion is that how do we store this data into Memcache.
Possibility 1 : We store each price in separate cache object and do a multiget if the price of all variant belongs to a model need to be displayed on a single page.
Possibility 2 : We store prices at the model, city level. Prices of all variants of a model will be stored in a single object. This object will be slightly heavy but multiget wouldn't be required.
Need your help in taking the right decision.
TLDR: It all depends on how you want to expose the feature to your end users, and what the query pattern looks like.
For example:
If your flow is that a user can see all the variant prices on a detail page for a city, then you could use <city_id>_<car_model_id> as the key, and store all data for variants against that key (Possibility 2).
If the flow is that a user can see prices of all variants across cities on a single page, then you would need the key as <car_model_id> and store all data as Json against this key
If the flow is that a user can see prices of one variant at a time only for every city, then you would use the key <city_id>_<car_variant_id> and store prices.
One thing to definitely keep in mind is the frequency with which you may have to refresh the cache/ perform upserts, which in the case of cars should be infrequent (who changes the prices of a car every day/second). So, I would have gone with option 1 above (Possibility 2 as described by you).

Restrict manager to only see list items created by their employees in SharePoint 2010

I am using a SP2010 custom list as a weekly time sheet for an organization of about 50 employees and 8 managers to use. To create an item, an employee enters client, project, activity type, week ending, and hours in the default view. Now I want to create another view that is restricted to managers. Ideally, I want SP2010 to know who the manager is, and restrict the items they can see to be only those items created by their employees.
I tried the following with no luck.
There is a user information list created by IT that includes all the members of my organization. I added the Manager's Name to every item.
I re-purposed the Modified By column appeared in my custom list when I created that list.
Specifically, I renamed the Modified By column which is a Person or Group type to Manager's Name and changed the value of Show Field: to Manager's Name. I would have rather not done it this way, but I couldn't figure out how I add a list column that is a Person or Group type, and allows you to pick a column to populate with the value I needed.
I saved the view settings and I could see the Manager's Names in the first column for their specific employees. So far so good!
Then I re-edited the view and created a filter that shows items when Manager's Name is equal to [ME].
I saved the view setting and this time I could not see any employee list items which made sense since I am not a people manager.
I had a colleague who is a people manager try it out and he saw no items for his employees, yet I know there are a dozen or so, and they showed up in #4.
I changed the filter to look for his name specifically, and he still could not see his employees, although I could.
So I figured it must be a permission level issue since his permission level was Contribute and mine is Full Control.
I bumped him up to Design level, and he could see his employees as long as I hard-coded his name in the filter for the view.
Do someone knows how to do this easily?
From what I have learnt, there are differences in creating lists and libraries.
A library does not seem to have the functionality displaying group fields in the correct format, whereas a list does. So if you want to create a view for managers / employees then you need to do it in a list, with the manager and employee both as columns in the view.
Just ensure that the employees and managers do not have access to edit their views.

FileMaker Pro -- Filtering Relationship Not Working

I'm trying to build a FileMaker Pro 11 layout that excludes records containing a certain value. The relevant data is in table Invoice. I want to filter so that Invoice records whose "Invoice Check Grouping" field is blank are not displayed on the layout.
I've added a global field to the invoice table called "Blank Invoice Check Grouping" to use as my filter criteria. I've created a self-join relationship to the Invoice table, joining "Invoice ID" to "Invoice ID" and joining "Invoice Check Grouping" to "Blank Invoice Check Grouping". The resulting table is named "Invoice Check Groupings".
The layout which I build based on table "Invoice Check Groupings" shows all records in Invoice--it does not filter out those with blank values. What am I doing incorrectly?
Thanks,
Ben
Layouts show records in a table (or more accurately, a table occurrence) and don't directly deal with related data. As mentioned by #pft221, you can use relationships for filtering, but only when viewing data through a portal.
If you always want a particular layout to show data based on a particular find, you can do so with a script and a script trigger. First set up a script to do the following:
Enter Find Mode[]
Set Field["Invoice Check Grouping"; "*" // Find all records with any data in this field
Perform Find[]
Note that you can also embed the find request within the Perform Find script step, but I tend to script finds in the above manner as it's easier to see what the find request is in the script and variables can be used in the find request.
Now you need to set your layout to execute this script whenever it's loaded. Go to the layout and enter Layout Mode. Select Layouts>Layout Setup from the menu bar. Click the Script Triggers tab and check the box for OnLayoutEnter and select the script you wrote above. Now whenever the layout is entered, that script will run and exclude the records that have that particular field being empty.
There are many ways to filter records, depending on what you are trying to do and what you are trying to display for your users.
The most common and simple way you can filter records is through a simple Find in a list view. I'm unclear from your question, but my best guess is that you're already using a list view and misunderstanding how FileMaker's relationships and Table Occurrences (TO's) work.
To Filter with the "Find Records" method:
Create a new List View layout of any Table Occurrence of your Invoice Table -- most likely you will want to use the default Table Occurrence that FileMaker created for you when you created the table.
Place the fields that you would like to display on that layout, including the "Invoice Check Grouping" field.
Switch into Find Mode
Put a '*' character into the "Invoice Check Grouping" field
Perform the Find
You should now see a list of all Invoices where the "Invoice Check Grouping" field is not blank. (You can find additional interesting search criteria in the "Insert: Operators" drop down of the title bar.)
Now you may actually be looking to filter related records through a portal but, given that you've set up a self-join on the Invoice index on the Invoice table my guess is that, at best, this would show either 0 or 1 record for each Invoice record you display in your main layout.
To Filter Records with the "Portal Filter" method:
Let's assume, though, that you have a Client table where you'd like to see only the records with a non-blank "Invoice Check Grouping" value. The table set-up would be as follows:
Client
Client ID
[... other client info ...]
Invoice
Invoice ID
Client ID
Invoice Check Grouping
[... other invoice info ...]
With a relationship in the relationships graph:
Client::Client ID ------< Invoice::Client ID
From there you would set up a Form layout on the Client TO and create a portal showing records from the Invoice TO. From the options for the portal you would select "Filter Portal Records" and use a formula similar to:
not IsEmpty(Invoice::Invoice Check Grouping)
Finally, it's worth noting that a portal filter isn't appropriate for all display situations or calculations. You can set up a similar filter completely through your relationships graph (as I believe you have already tried to do.) This will work, once again, for viewing records through a portal but not for the records displayed by a layout itself.
The answers above don't actually help Ben with his question. They are workarounds.
I have the same problem as Ben, and I don't think there is a solution, even now in Filemaker 12. There is I think no way to define a relationship that will omit the related records where the match fields are empty.
Two options come to mind:
On a specific layout, you have more fine-grained control in the portal definition itself, and can use this to exclude the records
You can now use SQL queries to achieve this result within Filemkaer.

Magento: how do I determine if a customer is new?

I want to be able to send different order confirmation emails to new customers than to established customers.
I am already able to put a block in the email template to insert my own 'if' constructs based on order details.
I can get the customer data from the order id, e.g. the customer id, but how can I determine if they are a new customer?
Even if it is getting the customer creation date and checking if it is less than five minutes, I need a technique to determine if they are new from within my template code based on the order information.
Either way your going to just have to do calculations on created_at field in the customer_entity table. If not your going to have to find some specific window to consider customers as "new".
Don't think I'd put said logic in the template file but rather a model and just pass it a block to flag it or not.

Resources