Newbies JohnM Posted November 25, 2002 Newbies Posted November 25, 2002 I'm making a simple recipes database which has built-in conversion and display of amounts of ingredients in metric and imperial measures. It also lets you recalculate the amounts in a recipe designed for x people for y number of people. On an entry layout you put in the original recipe with amounts of each ingredient for x people. Against each of 14 ingredient fields is an amount field and a popup list of units (ml, fl oz, pints, litres, gm, oz, lb etc). On a separate layout you can enter the y number of people and the amounts for each ingredient are then calculated and displayed in both metric and imperial. So for each ingredient you have an input amount field and then two calculated amount fields (one for metric, one for imperial). Times 14! These calculated fields use the same formula but with different parameters. The question (at last!) is, is there a way of creating user-defined functions (black boxes) to which one can pass parameters? Or do I have to paste and modify the entire calculation into the field definition in each case?
CobaltSky Posted November 25, 2002 Posted November 25, 2002 In a sense there are a couple of methods you can use that are a little like the 'black box' approach you've described. But not exactly... 1. You can place your conversion ratios (ie the result of your calculations) into global fields, and then rather than performing the full calculation each time, simply define each field as: SourceField * gConversionRatio 2. You can package up a conversion procedure into a script which computes a value based on a formula in which you have specified the source field as Getfield(gSourceField) where gSourceField is a global field with a value list of fieldnames for the fields holding the data you want to convert. If the script performs a Set Field [ ] step to place the result of its calculation into a temporary global field, then follows with an Insert Calculated Result [ ] step to place the temporary global field contents into the current field, then you will have a 'black box' where you can select the source field from a pop-up menu or list, place the cursor in the desired destination field (a text or number field), then run the script and the value in the specified field will be passed through the formula and placed in the current field. I'm not sure how applicable either of the above suggestions is to what you have in mind, but you may be able to adapt one of them.
Vaughan Posted November 26, 2002 Posted November 26, 2002 Ahhh, are you aware that recipes usually cannot simply be scaled up to make bigger batches? (This has nothing to do with limitations in FMP.)
CobaltSky Posted November 26, 2002 Posted November 26, 2002 Depends what you mean by 'usually', doesn't it Vaughan. What you say is principally true of recipes which use raising agents and such, but even in these cases the majority of ingredients would be scaled arithmetically, with certain categories of ingredients being scaled geometrically (but still scaled). John hasn't said what formulae he's using, nor what the recipes his system will cater for are. If they are for muesli, scrambled eggs, french toast, apple crumble and cocktails (not necessarily in that order) then simple arithmetic should be fine. Might need a checkbox for whether or not the recipe is sponge cake, though...
jasonwood Posted November 26, 2002 Posted November 26, 2002 I learn something every day on this forum, but I never expected to come here to learn about recipe scaling. While we're on the topic... does anybody have a good cheesecake recipe?
kenneth2k1 Posted November 26, 2002 Posted November 26, 2002 No, but i finally got this chicken n dumpling recepie from this chick at work. I ve been after her for months on this. Never really liked cheesecake.
Recommended Posts
This topic is 8104 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