Robert Collins Posted August 4, 2009 Posted August 4, 2009 (edited) I have found a couple of similar threads about this but none the solutions quite fit my requirements. I have a 'Products' table and in that table I have a field that holds the the quantity sold of a particular product. I also have a 'current product' (with Yes/No drop down selection) and a Category field (with pre-defined categories , again with a drop down menu) . I would like a field that holds the sales 'ranking' based on the fact is A) a current product and B. the product category. The threads that I have found suggest a self-relationship but I can't seem to get this to work. Any help would be much appreciated. I have attached a basic version of the file. Edited August 4, 2009 by Guest
comment Posted August 4, 2009 Posted August 4, 2009 (edited) The simple way to do this is by producing a report: find the current products, and sort them by amount sold. If you want to show this "live" at all times, you will indeed need a self-join to count products that sold more. Do you want an overall rank, or within the category only? Note: It's best to use a Number field for Boolean values (1 for True, 0 or empty for False). Edited August 4, 2009 by Guest
Robert Collins Posted August 4, 2009 Author Posted August 4, 2009 I need the rank number in a field not sorted on a layout and yes, I would like it ranked by category.
comment Posted August 4, 2009 Posted August 4, 2009 Try the attached. Note that switching a product's "current" status may require a refresh. Productexample.fp7.zip
Robert Collins Posted August 4, 2009 Author Posted August 4, 2009 thank you very much for that - I can see now that I was not far off which is a good sign. I didn't have a product id field. What's the easiest way to refresh should a product become discontinued?
comment Posted August 4, 2009 Posted August 4, 2009 (edited) A button set to Refresh Window[]. Or attach a script trigger to the Current field. Or make the Current field itself a button that toggles the status and refreshes the window. I didn't have a product id field. The ID field is not essential here - I just wanted to count a field that couldn't be empty. Edited August 4, 2009 by Guest
Robert Collins Posted August 4, 2009 Author Posted August 4, 2009 thanks for your help, I shall now implement this into my database
Robert Collins Posted August 4, 2009 Author Posted August 4, 2009 Right... well i've replicated the solution in my database and it shows a ? in the ranking field. I've studied the fields (and where neccesary , made sure they are set to Number rather than Text) and no luck . I have also made sure that the ranking field is set to general format so it won't make the result look strange. any ideas?
Robert Collins Posted August 5, 2009 Author Posted August 5, 2009 Yes, I had opened the field area right up but no joy i'm afraid.
Søren Dyhr Posted August 5, 2009 Posted August 5, 2009 Here's a method which adjusts to the found set, some refreshing issues still exists however: --sd ProductexampleSd.zip
Robert Collins Posted August 6, 2009 Author Posted August 6, 2009 right, I've found the problem . in Comments example , the Number Sold field is simply a number field that is indexed. in my database is a unstored calc field that is the Sum of (sales line items: Item Quantity). therefore would it be best to have the sales ranking relative to 'sales line items' rather than the'products' table? thanks
comment Posted August 6, 2009 Posted August 6, 2009 in Comments example , the Number Sold field is simply a number field that is indexed. Yes - because that's how it is in your original example file. Maybe something like this can work for you - I haven't tested it much. Note that the self-join must be sorted. Productexample.fp7.zip
Robert Collins Posted August 6, 2009 Author Posted August 6, 2009 (edited) Sorry, I should have mentioned that the quantity sold was coming from a different table. I've just looked at the example file - it looks like that will work great. The only thing i noticed is a refresh button doesn't update the ranking when the sales quantity increases so I will look for an alternative way of doing this. thanks again Edited August 6, 2009 by Guest
Søren Dyhr Posted August 6, 2009 Posted August 6, 2009 Note that the self-join must be sorted. ...Ah yes List( does is just as well, if not better! --sd
comment Posted August 6, 2009 Posted August 6, 2009 i noticed is a refresh button doesn't update the ranking when the sales quantity increases Try making the button do Refresh Window [Flush cached join results].
Kris M Posted August 12, 2009 Posted August 12, 2009 Comment ive got a curiosity question here.. In your example file cTrue is an unstored calc set = True (no quotations) and calc result is number.. Why not set calc result to text and set = "True"... Whats the difference?
comment Posted August 12, 2009 Posted August 12, 2009 True is a reserved word in Filemaker, and it evaluates to 1. See also: http://fmforums.com/forum/showpost.php?post/228583/
Recommended Posts
This topic is 5641 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