+ Reply to Thread
Results 1 to 7 of 7

Logical Calculation Problem

  1. Logical Calculation Problem

    1. I am trying to make a field calculation look something like this:
    If field x = "PO" then field y = (calculation) unless field y =
    (calculation) and field z = (calculation) and field b = (calculation)
    unless field A = ("xyz").
    Not exactly this but something close. how would I attack this?


    2. On top of all of this how do I erase the calculation results if I
    accidently put in "PO" and then want to remove all of the results
    brought on by the mistake?
    Thank you,
    Steve









    Let us say I own a candy store and I have 4 taffy stretchers, 3 sugar
    coaters and 3 chocolate melters (each machine (eg, the 4 taffy makers)
    do something different from the ones in their own group (one handles
    taffy with a max of x and min of y . I take custom orders from my
    clients and they are charged by the processes I do with the machinary
    above. I get an order for 1 lb of taffy and chocolate covered apples.
    --


  2. Re: Logical Calculation Problem

    Dwight Yoakam wrote:
    > 1. I am trying to make a field calculation look something like this:
    > If field x = "PO" then field y = (calculation1) unless field y =
    > (calculation2) and field z = (calculation3) and field b = (calculation4)
    > unless field A = ("xyz").
    > Not exactly this but something close. how would I attack this?


    With a case() statement on field y, something like:

    case(
    field a = "xyz"; "something",
    field x = "PO" and field y = calc2 and field z = calc3; "something else";
    field x = "PO"; calc1;
    // else itself
    field y)

    I'm not exactly sure what you were trying to do with your example, so
    the above calc is just made up. But hopefully you cat the idea.

    The above calc sets field y depending on the content of itself and of
    other fields. But perhaps you were trying to set multiple fields based
    on the content of field y? Or ...?

  3. Re: Logical Calculation Problem

    On 2008-06-08 15:23:14 -0400, Howard Schlossberg
    said:

    > Dwight Yoakam wrote:
    >> 1. I am trying to make a field calculation look something like this:
    >> If field x = "PO" then field y = (calculation1) unless field y =
    >> (calculation2) and field z = (calculation3) and field b =
    >> (calculation4) unless field A = ("xyz").
    >> Not exactly this but something close. how would I attack this?

    >
    > With a case() statement on field y, something like:
    >
    > case(
    > field a = "xyz"; "something",
    > field x = "PO" and field y = calc2 and field z = calc3; "something else";
    > field x = "PO"; calc1;
    > // else itself
    > field y)
    >
    > I'm not exactly sure what you were trying to do with your example, so
    > the above calc is just made up. But hopefully you cat the idea.
    >
    > The above calc sets field y depending on the content of itself and of
    > other fields. But perhaps you were trying to set multiple fields based
    > on the content of field y? Or ...?


    I am sorry, I reaaly did a poor job of explaining what I was trying to get at:

    Let us say I own a candy store and I have 4 taffy stretchers, 3 sugar
    coaters and 3 chocolate melters (each machine (eg, the 4 taffy makers)
    do something different from the ones in their own group (e.g., mach_1
    can handle 10lbs of taffy and stretchit to 5 ft. long and 3/4inch
    thick, mach_2 can handle 8 lbs. stretch it to 7ft. and 1/3in
    thick...etc.) This is the same situation for the sugar coaters and
    chocolate melters (i.e., all handle materials differently than the
    others in their own group).
    I take custom orders from my clients and they are charged by the
    processes I do with the machinary above. I get an order and send them
    through processes. First I have to quote the customer the order and I
    price them by the machine they go to (it takes more labor to use mach_1
    as opposed to mach_2 so it costs more to use mach_1).
    What I am trying to achieve is this:
    In fields above put in the numbers (lbs, thickness, coatings...etc.).
    Based on the info given, have the numbers dictate which machine the
    taffy will go to and price it as such.
    I hope this clears it up a little more for you and thank you for your help,
    Steve


  4. Re: Logical Calculation Problem

    Dwight Yoakam wrote:
    > On 2008-06-08 15:23:14 -0400, Howard Schlossberg
    > said:
    >
    >> Dwight Yoakam wrote:
    >>> 1. I am trying to make a field calculation look something like this:
    >>> If field x = "PO" then field y = (calculation1) unless field y =
    >>> (calculation2) and field z = (calculation3) and field b =
    >>> (calculation4) unless field A = ("xyz").
    >>> Not exactly this but something close. how would I attack this?

    >>
    >> With a case() statement on field y, something like:
    >>
    >> case(
    >> field a = "xyz"; "something",
    >> field x = "PO" and field y = calc2 and field z = calc3; "something else";
    >> field x = "PO"; calc1;
    >> // else itself
    >> field y)
    >>
    >> I'm not exactly sure what you were trying to do with your example, so
    >> the above calc is just made up. But hopefully you cat the idea.
    >>
    >> The above calc sets field y depending on the content of itself and of
    >> other fields. But perhaps you were trying to set multiple fields
    >> based on the content of field y? Or ...?

    >
    > I am sorry, I reaaly did a poor job of explaining what I was trying to
    > get at:
    >
    > Let us say I own a candy store and I have 4 taffy stretchers, 3 sugar
    > coaters and 3 chocolate melters (each machine (eg, the 4 taffy makers)
    > do something different from the ones in their own group (e.g., mach_1
    > can handle 10lbs of taffy and stretchit to 5 ft. long and 3/4inch thick,
    > mach_2 can handle 8 lbs. stretch it to 7ft. and 1/3in thick...etc.) This
    > is the same situation for the sugar coaters and chocolate melters (i.e.,
    > all handle materials differently than the others in their own group).
    > I take custom orders from my clients and they are charged by the
    > processes I do with the machinary above. I get an order and send them
    > through processes. First I have to quote the customer the order and I
    > price them by the machine they go to (it takes more labor to use mach_1
    > as opposed to mach_2 so it costs more to use mach_1).
    > What I am trying to achieve is this:
    > In fields above put in the numbers (lbs, thickness, coatings...etc.).
    > Based on the info given, have the numbers dictate which machine the
    > taffy will go to and price it as such.
    > I hope this clears it up a little more for you and thank you for your help,



    Well, it would still all be based on a case statement in a calc field.
    Something like this to define the machine number:

    case(
    type = "Taffy" and capacity > 8 length <= 5 and thickness > .333 and
    thickness <= .75; "Taffy1";
    type = "Taffy" and capacity > 6 length <= 7 and thickness <= .333 and
    thickness <= .75; "Taffy2";
    //else
    "Taffy3")

    Of course, you need to define all the parameters for each machine, and
    then get the case statements in the correct order, knowing that the
    first true case test will be the value that it uses.

    There are other ways to do this, as well, such as defining a Machines
    table, entering min and max numbers for each value type (thickness,
    capacity, etc) and then using a lookup (either a lookup type field, a
    calc that uses the Lookup() function, or a looping script or perhaps
    another method to find the correct machine.

    I'm not saying any of these methods would be easier or harder for you to
    set up and maintain. Just that there are as many ways to skin this cat
    as there are flavors of taffy.

    Hope that helps...

  5. Re: Logical Calculation Problem

    On 2008-06-08 23:31:54 -0400, Howard Schlossberg
    said:

    > Dwight Yoakam wrote:
    >> On 2008-06-08 15:23:14 -0400, Howard Schlossberg
    >> said:
    >>
    >>> Dwight Yoakam wrote:
    >>>> 1. I am trying to make a field calculation look something like this:
    >>>> If field x = "PO" then field y = (calculation1) unless field y =
    >>>> (calculation2) and field z = (calculation3) and field b =
    >>>> (calculation4) unless field A = ("xyz").
    >>>> Not exactly this but something close. how would I attack this?
    >>>
    >>> With a case() statement on field y, something like:
    >>>
    >>> case(
    >>> field a = "xyz"; "something",
    >>> field x = "PO" and field y = calc2 and field z = calc3; "something else";
    >>> field x = "PO"; calc1;
    >>> // else itself
    >>> field y)
    >>>
    >>> I'm not exactly sure what you were trying to do with your example, so
    >>> the above calc is just made up. But hopefully you cat the idea.
    >>>
    >>> The above calc sets field y depending on the content of itself and of
    >>> other fields. But perhaps you were trying to set multiple fields based
    >>> on the content of field y? Or ...?

    >>
    >> I am sorry, I reaaly did a poor job of explaining what I was trying to get at:
    >>
    >> Let us say I own a candy store and I have 4 taffy stretchers, 3 sugar
    >> coaters and 3 chocolate melters (each machine (eg, the 4 taffy makers)
    >> do something different from the ones in their own group (e.g., mach_1
    >> can handle 10lbs of taffy and stretchit to 5 ft. long and 3/4inch
    >> thick, mach_2 can handle 8 lbs. stretch it to 7ft. and 1/3in
    >> thick...etc.) This is the same situation for the sugar coaters and
    >> chocolate melters (i.e., all handle materials differently than the
    >> others in their own group).
    >> I take custom orders from my clients and they are charged by the
    >> processes I do with the machinary above. I get an order and send them
    >> through processes. First I have to quote the customer the order and I
    >> price them by the machine they go to (it takes more labor to use mach_1
    >> as opposed to mach_2 so it costs more to use mach_1).
    >> What I am trying to achieve is this:
    >> In fields above put in the numbers (lbs, thickness, coatings...etc.).
    >> Based on the info given, have the numbers dictate which machine the
    >> taffy will go to and price it as such.
    >> I hope this clears it up a little more for you and thank you for your help,

    >
    >
    > Well, it would still all be based on a case statement in a calc field.
    > Something like this to define the machine number:
    >
    > case(
    > type = "Taffy" and capacity > 8 length <= 5 and thickness > .333 and
    > thickness <= .75; "Taffy1";
    > type = "Taffy" and capacity > 6 length <= 7 and thickness <= .333 and
    > thickness <= .75; "Taffy2";
    > //else
    > "Taffy3")
    >
    > Of course, you need to define all the parameters for each machine, and
    > then get the case statements in the correct order, knowing that the
    > first true case test will be the value that it uses.
    >
    > There are other ways to do this, as well, such as defining a Machines
    > table, entering min and max numbers for each value type (thickness,
    > capacity, etc) and then using a lookup (either a lookup type field, a
    > calc that uses the Lookup() function, or a looping script or perhaps
    > another method to find the correct machine.
    >
    > I'm not saying any of these methods would be easier or harder for you
    > to set up and maintain. Just that there are as many ways to skin this
    > cat as there are flavors of taffy.
    >
    > Hope that helps...


    Actually it does. Thank you. How could a looping script help? I ask
    this because I have never understood the value of a looping script.


  6. Re: Logical Calculation Problem

    Dwight Yoakam wrote:
    > How could a looping script help? I ask this
    > because I have never understood the value of a looping script.


    I guess what I had in mind was storing the parameters in script
    variables, going to a separate table where all the machines are defined,
    and then looping through those machine records until we find a set of
    machine parameters that matches our job variables.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Howard Schlossberg
    FM Professional Solutions, Inc. Los Angeles

    FileMaker 8 Certified Developer
    Member, FileMaker Business Alliance

  7. Re: Logical Calculation Problem

    On 2008-06-09 21:54:04 -0400, Howard Schlossberg
    said:

    > Dwight Yoakam wrote:
    >> How could a looping script help? I ask this because I have never
    >> understood the value of a looping script.

    >
    > I guess what I had in mind was storing the parameters in script
    > variables, going to a separate table where all the machines are
    > defined, and then looping through those machine records until we find a
    > set of machine parameters that matches our job variables.
    >
    > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    > Howard Schlossberg
    > FM Professional Solutions, Inc. Los Angeles
    >
    > FileMaker 8 Certified Developer
    > Member, FileMaker Business Alliance


    The more I delve into this idea the more I like it but am not able to
    set up the scripts. Would it be possible to show me an example of one.
    Below is an actual calculations in order to find what mill to use
    (defined in loc_temper) and then what it would cost to use that
    particular mill (defined in united_mill_cost and mesta_mill_cost):

    united_mill_cost
    Calculation (Number)
    = Case (( loc_temper<>"United Narrow Mill");"";
    width_tol_max ≤ 14.5 and width_entry_total_min ≥ 8.001; 1.25;
    width_entry_total_min ≥ 5.001 ; 1.5;
    width_entry_total_min ≥ 3.001 ; 1.75;
    width_entry_total_min ≥ 1.5 ; 2.5;
    "Error")

    mesta_mill_cost
    Calculation (Number)
    = Case (( loc_temper<>"Mesta Temper Mill");"";
    ga_max_total ≤ .53 and ga_min_total ≥ .391 ; .75;
    ga_min_tol ≥ .171 ; .5;
    ga_min_tol ≥ .082 ; .6;
    ga_min_tol ≥ .067 ; .8;
    ga_min_tol ≥ .053 ;1 ;
    "Error")

    loc_temper
    Calculation (Text) =
    Case (( width_entry_total_min ≥ 1.5 and width_entry_total_max < 15.5 )
    and (ga_min_total ≥ .04 and ga_max_total ≤ .375); "United";
    (width_entry_total_min ≥ 15.5 and width_entry_total_max < 72 ) and
    (ga_min_total ≥ .056 and ga_max_total ≤ .375) and (width_tol_max ≥ .003
    and width_tol_min ≥ .003); "Mesta";
    (width_entry_total_min ≥ 24 and width_entry_total_max ≤ 86) and
    (ga_min_total ≥ .125 and ga_max_total ≤ .875); "L4" ; "Error")

    What would a script for this look like?

    On a side note, I really do appreciate all the help you have given me
    over the last few months. I have actually been able to put together a
    very crude rendition of what I want to achieve, yet it is very acurate
    for what I have set it up to do. Thank you very much,
    Steve
    --


+ Reply to Thread