# Best way to generate calc based on multiple criteria

This topic is 5700 days old. Please don't post here. Open a new topic instead.

## Recommended Posts

Whats the best way to generate a calc based on the following criteria. I should say I now have it set up as a Case based Calc spelling out each of the possible scenarios. I am trying to figure out how long it takes to produce a job.

We have 3 pieces of equipment. Press1, Press2, Press3. Each press can operate 3 differnt ways, Style1, Style2, Style3. My case is written as(shortend for this question)

Case(Press1 and Style1=1; Press1 and Style2=2; Press1 and Style3=3; Press2 and Style1 = 4 and so on. I feel like there should be a better way to do this.

##### Share on other sites

Hard to answer without knowing how each piece of data affects the duration of the job.

##### Share on other sites

Each Press runs at a specific run rate, 2000, 5000 or 10000 per hour. The styles also affect the calc because each style takes a different amount of time to setup for.

##### Share on other sites

If I don't know how to do to a calculation using only pencil and paper, I don't know how to make it in Filemaker either. You need to put a bit more effort into this.

##### Share on other sites

Scott

I have a similiar scenario in my solution. I decided not to use a straight calc field but instead (for other reasons) to script the calculation.

In my script I decided to calculate the setups seperately from the run times. This gave two advantages.

Firstly, from a developers point of view the calcs were fairly easy to construct and follow and secondly from the users point of view I could display the results seperately when giving a breakdown of the total calculation. The disadvantage of course is that the user has to press a button to do the calc but as I said, for other reasons I decided that this was the best way for me.

If scripting is not an option in your case you could achieve the same advantages by using three calc fields. One to calc the make readies, one to calc the run times and one to add the two together if necessary. Other than that it is down to a single calc field that as you discovered can soon get very long and if your process is anything like mine (we are printers) with the other factors that might affect the calc can soon get very complex and almost impossible to unravel when you revisit them after the initial construction. I have had more than my fair share of 'Bloomimg heck did I write that one!!' moments, hence my decision to break the calc down a little.

HTH

Phil

##### Share on other sites

Hi Phil, we are printers as well. As you guessed, I am trying to calc makereadies for each press along with run times based on colors and print styles. At this point, we only have 3 presses and really 3 print styles, Sheetwise, work&turn or perfect. I have the press time field set up to select an option from a Case calc. Do you have an example of the scripted calc you wrote I could look at?

##### Share on other sites

Hi Scott

I am out of the office now until Thursday. I will get back to you then

Phil

##### Share on other sites

You might try using the Let function to simplify your calculation. E.g.

```Let( [press = Case(PressChoice="Press1";2000;PressChoice="Press2";5000;PressChoice="Press3";10000) ;

style = Case(StyleChoice="Sheetwise";123;StyleChoice="work&turn";234;StyleChoice="perfect";345)] ;

press + style   // or whatever your calc is

)```

Another option might be to put the presses and styles in their own little tables and use relationships to pull in the numbers for your calc.

##### Share on other sites

This topic is 5700 days old. Please don't post here. Open a new topic instead.

## Create an account

Register a new account