Script or calc. field for "kitchen conversions"

I have a database of products and cost of goods sold. At this point I would like to break the numbers down further. Ideally I would like to have (either in a different layout, or seperate database) a way to take e.g. 5 lbs. and $23.00 and push a button which could break those numbers down into cost per teaspoon, cost per quart...etc. I will use this to get my idea cost of goods sold for menu items at my coffee shop. Any ideas or suggestions? Should I make it a seperate database using portals to connect the two? How do I build the calculations? I was thinking of a pop up list of measurements with a script for calculating by whichever measurement I chose. How could I build such a beast?
Thank You,
Steve
sberebitAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

KungFoolioCommented:
You can use a conversions table (database) to do this.

Create a new database with the following fields:
StartingUnit  (text)
EndingUnit    (text)
Conversion    (number)
UnitConcat    (calculation, StartingUnit&"_"EndingUnit)
You will have to define each of your conversions with each record. Ex. StartingUnit = gal, EndingUnit = tbsp.

In your main file, you will need the following fields:
BulkSize   (number) ex. 5
BulkUnits  (text)   ex. gal
BulkCost   (number) ex. $23.00
ServingSize (number)ex. 1
ServingUnit (text)  ex. cup
UnitConcat (calculation, BulkUnits&"_"&ServingUnit)

Now, we need relationships:
In the main file, create a relationship to retreive conversion factors. MainFile and ConversionFile, match UnitConcat with UnitConcat. Create another relationship called BulkUnits between MainFile and ConversionFile between BulkUnits and Starting Units. this will be used later to be sure make comparisons between units that you have conversions for.

Now, on to calculations in MainFile:
-Create a Conversion field, type number, Options=Auto-enter looked up value, using ConversionFile, copy Conversion.
-Create a ServingUnitsPerBulkQty field to tell you how many serving units you get from the bulk box/drum/whatever. Make it a calculation,unstored, (BulkSize*Conversion)/ServingSize.
- Now the final calc to tell you how much each serving costs ServingCostPerUnit, calculation,unstored, BulkCost/ServingUnitsPerBulkQty.

Now, on to the layouts, and to make this all work:
Add to your layout: BulkSize, BulkUnits, BulkCost, ServingSize, ServingUnits, ServingCostPerUnit.
In Layout mode, right click on BulkUnits, choose field format, select Popup list, define a new list of Bulk Units, use values from field, specify ConversionFile, and choose StartingUnit. OK, Done. Then right click on Serving Units, choose field format, select Popup list, define a new list of ServingUnits, use values from field, Only related values, using the relationshipt BulkUnits, and using values EndingUnit. This ensures that you can only create conversions for unit conversions that you have defined.

Try it out. Email david@cloutier.cc if you would like a copy of the example.

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
FileMaker Pro

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.