March 3, 201213 yr Hi, i have a complex lot of calculations that I am trying calculate in number fields. In order to not have them in an unstored calc (performance), what I did is: let ([ trigger = timestamp ]; Calculate ( TextfieldinwhichIwrotethecomplexcalcperrecord) ) Works like a charm if e.g. I let it calculate 12, returns 12. Now what I would love it to do is: calculate $$global to return 3 if $$global equals 3. Unfortunately filemaker 11 wont do that. It calculates all kinds of complex relationships (I copy them from an unstored calc field). However to make the calcs more accessable I started generating global vars to do the trick. It does not work. Am I missing a different formula here? Thanks ole
March 4, 201213 yr Author Sorry wrong translation. Of course it is evaluate ( textfieldthatholdstheformula)
March 4, 201213 yr I am afraid you are not making yourself understood. By "Calculate" do you mean the Evaluate() function? And what does this have to do with the calculation being stored or not?
March 4, 201213 yr Author sorry, let me try to rephrase: I have a stored number field (lets call it: article amount). This number field is set to calculate a formula (lets call it: formula that results into amount of article). The number field is not an unstored calculation because in that case it would make using the database over WAN impossibly slow. So: The number field is evaluating the formula above which is in another text field. I checked that formula within the dataviewer to check if the sytax is correct. All works so far- unless- I am using a global variable in my formula (the one that is in the text field). eg. I generate $$a with the value of 2. If I Evaluate ( Textfieldthatholds$$a) it returns nothing. What could I be missing or is that something I cannot do? Thank you
March 4, 201213 yr The number field is not an unstored calculation because in that case it would make using the database over WAN impossibly slow. I still don't see the connection between your goal and the convoluted way you have chosen to accomplish it. Why don't you simply run a script to: Set Field [ StoredNumberField ; YourFormula ] This will eliminate the need for all the other fields - and your formula will be automatically updated if you rename any of the referenced fields or tables.
March 4, 201213 yr Author I still don't see the connection between your goal and the convoluted way you have chosen to accomplish it. Why don't you simply run a script to: Set Field [ StoredNumberField ; YourFormula ] This will eliminate the need for all the other fields - and your formula will be automatically updated if you rename any of the referenced fields or tables. Thanks for your help so far. I would do it with a script. However- I have about 4500 articles that I am using for quotes, invoices and such under different circumstances, lets call it profiles. Of these 4500 articles, around 500 have a formula for the amount, around 600 have another formula for the price per unit. Around 1200 are used in 45 different profiles (calculated by a formula). That makes roughly 49000 script steps- I already figured out how to calculate the numbers. I am just stuck in getting filemaker to evaluate a textfield with $$var in it in order to reuse some of the references already made once. I will try to build an example. If anyone can pitch in meanwhile I would appreciate it. Thanks ole
March 4, 201213 yr It's hard to advise with so little information. However, I would look very hard for a way to generalize each formula as much as possible, thus reducing the number of formulae required - rather than store formulae as text. In any case, I don't see any reason why Evaluate ( Textfield ) wouldn't return 3 when Textfield contains "$$variable" and the value of $$variable is 3.
March 4, 201213 yr Author I understand. I am loading about 90 conditions into $$vars before i loop through the records to refresh the number field. It is really fast to calculate with the formulas that I have written and it should be much faster when using the global vars. And no- it does not return 3 though it returns 3 in the data viewer.
March 4, 201213 yr And no- it does not return 3 though it returns 3 in the data viewer. It does not return 3 where? If it's a stored calculation field, you must get it to re-evaluate after you have populated the variable. In your original post, there is a timestamp field being used as a trigger; you need to modify this field or the TextfieldinwhichIwrotethecomplexcalcperrecord in order for this to happen. -- Of course, the simpler way is to set the field directly to the result - even if the formula is stored externally. Edited March 4, 201213 yr by comment
March 4, 201213 yr Author It does not return 3 where? If it's a stored calculation field, you must get it to re-evaluate after you have populated the variable. In your original post, there is a timestamp field being used as a trigger; you need to modify this field or the TextfieldinwhichIwrotethecomplexcalcperrecord in order for this to happen. -- Of course, the simpler way is to set the field directly to the result - even if the formula is stored externally. yes, I understand that it has to re-evaluate after population of the variable. The timestamp is set by script. I also said that the recalculation works fine - IF - inside the textfield that holds the formula there will be no $$var and no again- set the field directly to the result is not an option, I want to reuse the info of the vars while looping through the formulas- and it is too complex. You might try it yourself: set a global vars put the name of that vars in a text field evaluate the textfield from within a number field (using a trigger such as timestamp). It does not work. It results nothing. Huh- maybe thats the answer- after setting the global vars do i need to flush cache to disk?
March 4, 201213 yr There is no point in trying it ourselves. We can make it work. We need to see a concrete example - in the form of a file - that shows what YOU are doing. Please also recognize that trying to guess what you are doing isn't a good use of our time. You are asking us to play guessing games and you are hiding the clues. Submit a file.
March 4, 201213 yr You might try it yourself: set a global vars put the name of that vars in a text field evaluate the textfield from within a number field (using a trigger such as timestamp). It does not work. It results nothing. I have tried it for myself, and it does work. There is something missing from your description. Why don't you post an example file like you said you would?
March 4, 201213 yr no again- set the field directly to the result is not an option, I want to reuse the info of the vars while looping through the formulas- and it is too complex. I don't see the contradiction: if the variables are global, they will persist until you close the file. It's still simpler to set the target field directly to the calculated value instead of setting another field as a trigger.
April 3, 201312 yr Author Solution Solved by accident (while discarding the refresh via a trigger field). Sometimes I look at a thing forever and dont see the answer. It was a separation issue. The globals variables were defined in the file running the refresh script. The fields on auto calc were in the data file (different file). I had to pass the global variables to the data file first to make it work. Discarded it now, because in a different scenario I am duplicating these records and dont want the values to change. Thanks for everyones approach though.
Create an account or sign in to comment