Matthew R White Posted August 20, 2015 Posted August 20, 2015 I have a field called Producer Code and when I enter a layout I would like to randomly enter 1 of 3 numbers into this field. Either 2, 3, or 9. Whats the best way to do this?
comment Posted August 20, 2015 Posted August 20, 2015 You could set the field to a calculated value = Let ( r = Int ( Random * 3 ) + 1 ; GetValue ( "2¶3¶9" ; r ) ) I am not sure hard-coding the values is a good idea, though.
Matthew R White Posted August 24, 2015 Author Posted August 24, 2015 Is there a way to sequence this 2, 3, 9 instead of random?
comment Posted August 24, 2015 Posted August 24, 2015 Is there a way to sequence this 2, 3, 9 instead of random? You would have to record the last choice somewhere.
Matthew R White Posted August 27, 2015 Author Posted August 27, 2015 I'm looking for a calculation that upon entering a layout would sequentially enter 2, 3, then 9 then back to the start. Would I need to create a new field to store the previous number entered or? Thanks!
comment Posted August 27, 2015 Posted August 27, 2015 (edited) I already answered this question here: Why do you need to start a new thread for this? Edited August 27, 2015 by comment
Matthew R White Posted August 28, 2015 Author Posted August 28, 2015 Can you expand on your answer? Should I set up a new field to record? What does the calculation look like as I don't see a "sequential" action in filemaker.
comment Posted August 28, 2015 Posted August 28, 2015 I suggest you expand on your question first - and do so in the original thread, so that this one can be deleted.
Matthew R White Posted September 15, 2015 Author Posted September 15, 2015 Thanks Mr Vodka. Here is my question expanded: I'm looking to create a script (performed when entering a quote layout) that automatically (sequentially) inserts 2, then next time a 3, then 9, then back to 2. This is for producer 2, producer 3, producer 9. This way the new business quotes are distributed evenly to each producer.
comment Posted September 15, 2015 Posted September 15, 2015 Here is my question expanded: No, actually it's the same question repeated. And it makes very little sense. Why would you want this to happen whenever you enter a quote layout? If you want new business quotes to be distributed evenly among the producers, then this should only happen when you create a new quote. And no script would be required: you could simply auto-enter a calculated value, based on the quote's auto-entered serial number ID (hopefully you have one in place) = Choose ( Mod ( QuoteID ; 3 ) ; 2 ; 3 ; 9 ) --- P.S. In the long run, randomly generated values as shown above will be just as evenly distributed among the producers as numbers assigned in strict sequence. This is known as the law of large numbers, one of the fundamental laws governing this universe.
Matthew R White Posted September 15, 2015 Author Posted September 15, 2015 Because when we enter quotes I have a script that opens a new window and goes to the New Quote Layout. This layout is only for entering new quote information. After entered the user hits submit, the window closes and filemaker navigates to our main database layout. So, the act of entering the quote layout automatically creates a new record and assigns it to a specific producer (evenly) 2, then 3, then 9. I currently have a random calculated value set in the calculation and its assigned the last 4 quotes in a row to producer 2. I have attached the calculation. You'll notice something else, If user Kim (producer 2) enters a quote, the code is set to 2, etc for Matt (2) and Bill (9). The only time a random or hopefully sequential number is entered is when Rose enters the layout. As she inputs all the online quotes. bwi.tiff
mr_vodka Posted September 15, 2015 Posted September 15, 2015 What happens if Kim creates 10 on her own, Matt 3, and Bill 5? Does Matt keep getting assiged whenever Rose creates a new quote? IOW is the quote being assigned to whoever has the least in the system to distribute evenly or should it just be distributed evenly only by Rose and indepedent of when the others enter in their own quote.
comment Posted September 15, 2015 Posted September 15, 2015 (edited) Because when we enter quotes I have a script that opens a new window and goes to the New Quote Layout. This layout is only for entering new quote information. IMHO, if something needs to happen every time you create a new record, then it should happen as a result of creating a new record. Today you create a record only by entering a specific layout - tomorrow you may want to add another way. Anyway, this is just a minor point in this discussion. If user Kim (producer 2) enters a quote, the code is set to 2, etc for Matt (2) and Bill (9). The only time a random or hopefully sequential number is entered is when Rose enters the layout. As she inputs all the online quotes. As I tried to explain earlier, you cannot enter the next number in a sequence without knowing what the last number in the sequence was. In this example, you would have to find out what the code was in the last record created by Rose. This could be determined by finding this record, or by defining a relationship that shows only records created by Rose (or not created by one of the producers). Alternatively, you would have to write this number in a preferences record somewhere where it can be easily retrieved. IMHO, no mater which method you choose, the resources required to implement it will far outweigh any advantage a strict sequence may have over a random assignment. Edited September 15, 2015 by comment
Matthew R White Posted September 15, 2015 Author Posted September 15, 2015 Mr Vodka, If Kim takes 10 calls for quotes and inputs them into filemaker which automatically assigns them to her, it's 100% ok for her to have 10 and me to have 3 for example because our intent is if a new customer speaks to a particular agent over the phone, that agent should be assigned to them in perpetuity. If a web quote is entered by rose, the new customer hasn't spoken or built a relationship with any agent therefore we'd like it to be assigned evenly to one of currently 3 agents but more in the future. Does that make any sense? Comment, I'm trying to understand your suggestion but from what I gather you would suggest prior to executing the script, perform find for (most recent record created), set a variable for that number. Then create an If, else. If the number is 2, then set field as 3, else if number is 3, set field as 9. Then proceed with the script and the numbers should be evenly distributed? Thanks for all the help!
comment Posted September 15, 2015 Posted September 15, 2015 Comment, I'm trying to understand your suggestion but from what I gather you would suggest prior to executing the script, perform find for (most recent record created), set a variable for that number. Then create an If, else. If the number is 2, then set field as 3, else if number is 3, set field as 9. It's not really a suggestion, more like a warning... Anyway, your description is correct, except: (1) you can do this within the existing script, and (2) you need to locate not the most recent record created, but the most recent record created by Rose. I would also use a calculation instead of If, Else, but that's not essential.
Recommended Posts
This topic is 3368 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