Heathbo Posted May 27, 2005 Posted May 27, 2005 Wasn't sure which forum to post this in. I have a layout with 4 fields. 3 fields act sorta like grocery carts. The other field is a total field. The 3 fields have popup list that is created from records in another table (Product Table). In each record in the Product Table there is a field titled cost. This field shows a dollar amount. What I need to figure out is how to get the total field in the first layout to reflect the total cost of the items selected in the 3 fields. I hope this isn't too complicated. Any help you can give is much appreciated.
-Queue- Posted May 27, 2005 Posted May 27, 2005 Assuming you already have a relationshp to Product Table for each of the 3 fields, use a calc of Sum( relationship1::cost; relationship2::cost; relationship3::cost ). If you do not have the relationships, you will need to create them. It would be best to use the product id as the key field, in which case your popup list should include the product id field as the first field and the description as the second one. If you don't want to do that, you could use a one row portal with a scrollbar, instead of a popup list, to populate the fields.
Heathbo Posted May 27, 2005 Author Posted May 27, 2005 Got it: Different Question, similiar situation. I have another layout similiar to the one above. The only difference is the popup list is created from records in the same table. How would I do it in this situation since there isn't a relationship involved?
-Queue- Posted May 27, 2005 Posted May 27, 2005 I would think you should do the same thing, only use self-relationships instead of inter-table ones.
Heathbo Posted May 27, 2005 Author Posted May 27, 2005 I'm having trouble doing the self-relationships. Can you give me an example? I think using portals instead of fields makes more sense, don't you?
-Queue- Posted May 27, 2005 Posted May 27, 2005 Could you post a copy of the file and describe which table, layout, and fields to inspect? I should be able to answer your questions better afterward.
Heathbo Posted May 28, 2005 Author Posted May 28, 2005 In the attached file there is two tables, Grocery, and Grocery Join. In the Grocery table there are two layouts. One is called Products, the other is called checkout. There is a portal in the checkout layout with two fields. One is called Join ID, the other is called Name. There is also a Total Price field in the layout. What needs to happen is, in this portal I need to be able to click on the Join ID or another field in the portal and select the products that are in the same layout. The Total Price field then needs to update the price of all the products in the Portal.
Heathbo Posted June 3, 2005 Author Posted June 3, 2005 I guess there is no solution. Maybe making them separate tables is the way to go.
bruceR Posted June 3, 2005 Posted June 3, 2005 There is a solution. But you are not explaining what you want to do. Also, why does a carrot have a shopping cart? That's not where this information belongs.
Heathbo Posted June 3, 2005 Author Posted June 3, 2005 OK, what has to happen is this. The products layout is just what it is. Records of all the products. The checkout layout is where you select what products you want to check out with. In the checkout layout, there is a portal list. In this list you should be able to select the products you want to checkout with. The problem is, is I don't know how to link a table to itself. The Total Price field in the checkout layout is supposed to show you the total price of all the products in the portal list.
bruceR Posted June 3, 2005 Posted June 3, 2005 Your solution is incomplete. You do not need a self relation, you need a third table. You need Products, Cart, Cart_Items. You've only go the first two. CartTotal would then = sum(Cart_Items::ExtendedPrice). This is the standard Invoice structure for which there must be about a million examples. See attached. test.zip
Heathbo Posted June 9, 2005 Author Posted June 9, 2005 Just out of curiosity, Is it possible to do this with only two tables? What if I wanted the list of all the products and its total on the products layout?
bruceR Posted June 9, 2005 Posted June 9, 2005 I can't see how your request makes any sense. What is it that you are trying to accomplish?
Recommended Posts
This topic is 7164 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now