Newbies carail Posted May 31, 2012 Newbies Posted May 31, 2012 I'm very new to FM How do i get a count field to restart after it reaches 11? I want a field that auto-enters a number on report creations. I want it to start at 1, but after it reaches 11 i want it to restart at 1 again. Second question: I have 2 tables, #1 customers (parent table), #2 orders (child table) how do i create a calculation field thats sums up the total of a customers last 10 orders. Only the last 10 orders according to the date field in the order table? Thank-you in advance, im very new to this, if been seaching for both answers but cant figure it out.
comment Posted May 31, 2012 Posted May 31, 2012 Re #1: Can you explain your purpose here? It seems like an unstored calculation field (result is Number) = Mod ( Get ( RecordNumber ) - 1 ; 11 ) + 1 could be the answer - but it seems rather pointless. Re #2: There are several ways to achieve that. Is this for a report, or do you need it "live" in the customer layout? Also, please update your profile to reflect your version and platform.
Newbies carail Posted May 31, 2012 Author Newbies Posted May 31, 2012 version 10, windows, sorry about that. I need it live in the customer layout. The idea is a loyalty discount program. In my case its always 1 item per order. When a customers purchases 10 items that are the same the 11th is free. I need this calculation for when the items purchased are of different values. So if i can add up the cost of the last 10 items and figure out 10%, i will know what value to apply to the 11th purchase. I was guessing i could create a script that would trigger each time the count reaches 11 and would automatically apply the discount.
comment Posted May 31, 2012 Posted May 31, 2012 So if i can add up the cost of the last 10 items and figure out 10%, i will know what value to apply to the 11th purchase. Ahm... the last 10 orders are not the same thing as the last (up to 10) orders since the latest discount.
Newbies carail Posted May 31, 2012 Author Newbies Posted May 31, 2012 The discount is always on the 11th order. Even if the field displays 10% of the last 10 orders, the user simply wont take it into account when creating the invoice for orders that arent numbered 11. What about using a portal field on the customer layout, can i create a field that calculates an amount that is displayed in a portal field? I could set the portal field to display the customers last 10 orders, an then the user could simply credit that amount manualy when creating the invoice.for number 11.
comment Posted May 31, 2012 Posted May 31, 2012 (edited) The discount is always on the 11th order. Perhaps you should automate this, so that if an order is #11 (or #22, #33, etc.) in the customer's series, a discount is automatically applied? You also need to consider what should happen if an existing order is canceled for any reason. Edited May 31, 2012 by comment
Newbies carail Posted June 1, 2012 Author Newbies Posted June 1, 2012 Perhaps you should automate this, so that if an order is #11 (or #22, #33, etc.) in the customer's series, a discount is automatically applied? Ive thougt about that, if i cant get it to work thats definetly what im going to try. You also need to consider what should happen if an existing order is canceled for any reason. in this case a customer cant cancel the order after it has gone though, witch is about 15 minutes. So the canceled record will simply be deleted before any more are made. I'm new at this. For adding up the last 10 orders i just don't know where to start. Mod ( Get ( RecordNumber ) - 1 ; 11 ) + 1 Edit Just tried this this work fine for the field count Thank you
Recommended Posts
This topic is 4615 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