Query

167 views
Skip to first unread message

Andrea Orlandi

unread,
Oct 13, 2014, 5:09:56 AM10/13/14
to memento...@googlegroups.com
Hello everyone
I would like to know if it's possible to do a sort of query with memento

I have 2 libraries: "Products" and "Orders"

In the first one I set all the items of a collection with their price and a link to the order.
So I have
- Product
- Model
- Cost
- Order

The second library set the information of the orders so I have the seller and the date of the order.

When I fill the data in the "Products" library I have to chose wich is the seller and the second library
automatically refresh listing all the products contained in that order. And this is done very well.

Then, what I would like to do is to sum all the product's cost of the selected order so that when I choose
an order, I can see all the item bought in that order and see wich is the total amount of the order.

Is that possible?

Thank you

Andrea

Bill Crews

unread,
Oct 13, 2014, 7:46:42 AM10/13/14
to memento...@googlegroups.com
Andrea, I believe the answer is Yes and that there are two parts to the answer.

1. First, since there will be multiple orders for each product, the link needs to appear in the Orders library to the Products library to identify what product the order is for.

2. Memento allows one to create a Mass Calculation field to calculate a total. It also allows one to create that field with a dependency upon another field. So the total of orders for a seller could be such a field, giving the total you want.

To also include a total for a different range, such as a grand total across all sellers, one would need a separate field for that total, and this field would have the same calculation, but no dependency.

Now, PERHAPS it is possible to use only one total field that will serve both purposes. When the user wants to see only those records for a particular seller, he or she could use a filter on the seller (link) field. My question to others is: Can the one total field in this case display the total only for the items currently filtered by the user, or would it necessarily display only the full total in all cases? If the latter is true, you'll need both of the totals I described earlier, if you want to show a grand total when filtered.

-Bill

Andrea Orlandi

unread,
Oct 14, 2014, 7:17:28 AM10/14/14
to memento...@googlegroups.com
Thank You Bill for your reply

But I still have some problem.

Maybe I misundertood the point 1) but in my database I will have many products in one order so I think the link should
be placed in the Products library to the Orders library.
Now, after I add new products and I link them, in the "Orders" library are correctly listed all the products of the selected order
exactly as I want.

Then I also thought that the mass calculation was exactly the function needed for this case. But it woks only
with the fileds of the current library and not with the field of the linked library. So in the "order" library it show me
just the seller and the date. The price field is in the other linked library and the mass calculation doesn't allow me to
use that field.

Maybe I miss something

Bill Crews

unread,
Oct 14, 2014, 9:48:50 AM10/14/14
to memento...@googlegroups.com
Andrea, if you put a link in Products to Orders, you must have a very small business -- so small that you can define a link field in Products for every order a product would ever have. If you instead put a link in Orders to Products, that's not so extreme, but you still limit the number of products that can be on an order to the number of such link fields you define in the Orders library.

I think Memento is among the very best of databases for mobile devices, but representing many-to-many relationships like products and orders is difficult or impossible for all of them.

Memento can do it. One would use:
- a Products library with no links to orders
- an Order library with ID & date information and a seller ID or link, but no links to products
- a 3rd (called associative) Order Items library that simultaneously identifies the products on an order and the orders for a product, containing (besides a link to a product & a link to an order) information such as size or style for that order of that product.

Though this can be done in Memento (to its credit), limitations arise, as you have already surmised. Features one would like to use may require referencing a field in another library, and that may not be possible. And the view would be complicated.

I hope others will contribute, because there could be an (at least partial) solution using features I haven't used, like multiple pages for a library list view, but I cannot picture it.

-bc

Reply all
Reply to author
Forward
0 new messages