flysurfing Posted January 19, 2009 Posted January 19, 2009 Dear All, Cf. my attached file. I am trying to do something who seems quiet simple: I have a field called Total. I would like that when: 1/ Input a number in the field Add to Quantity it do the addition of this number into the Total Quantity field. 2/ Input a number in the field Remove of Quantity it subtract this number into the Total Quantity field. How could i do this ? Thanks a lot for your help ! Cheers
LaRetta Posted January 19, 2009 Posted January 19, 2009 (edited) I responded but deleted it. I'm unsure what you are trying to accomplish. If you have a Total calculation and you have two fields (one to add and one to subtract) then the Total calc would be simply: Add to Quantity - Remove from Quantity But I've the feeling I'm missing something else you are looking for. Can you give examples of exact how you expect the Total field to behave if you enter something in each of the fields - give us a sequence of 3-4 entries so we can see the pattern you wish to achieve. In other words, if you have a 3 in the Add field, do you want it to add to the Total but then if you change the Add number, it adjust (so the Add and Remove always equal Total) or do you want to use the Add and Remove like a calculator with the figures adjusting each time? LaRetta :wink2: Edited January 19, 2009 by Guest Modified
flysurfing Posted January 19, 2009 Author Posted January 19, 2009 Hello, Thanks for your answer dear. But there is still a problem: When i input a number inside the field add to quantity or remove of quantity it well do the calculation. Only problem, when i try to delete the number i inputed in the field add to quantity systematically the number one appears in the field. It should be great that after you input a number inside the add or remove field, the number inputed automatically disappear. Do you know how i could fix this ? Thanks a lot for ur help.
LaRetta Posted January 19, 2009 Posted January 19, 2009 Okay, I find your response a bit difficult to follow. Please repeat it using different words and, give me example of the keystrokes (adding and deleting a number) and how the total field should accumulate your results. Then we can adjust accordingly. :smile2:
flysurfing Posted January 19, 2009 Author Posted January 19, 2009 Hello, What Is happening: 1/ I write the number 500 in the field add to quantity. 2/ I press enter. 3/ Quantity field display value 500. 4/ I now try to delete the number 500 from the field add to quantity. Then the number 1 appears in this field and is added to the total quantity field. So It seems impossible to remove the value entered in add to quantity or remove to quantity, which means then every addition or subtraction is false. I hope now it is more clear : Thanks
LaRetta Posted January 19, 2009 Posted January 19, 2009 Can you post a quick simple file for us to view what you mean? Zip it and it can be attached at the bottom of your post where it says in blue 'Manage Files'. I don't understand why a 1 would pop into the Add field when you delete the 500. Don't worry, we'll figure this out together! LaRetta
flysurfing Posted January 19, 2009 Author Posted January 19, 2009 Hello, Here it goes : Thanks to remove the .jpg after the .fp7 Thanks a lot !
Ocean West Posted January 19, 2009 Posted January 19, 2009 (edited) you should compress your .fp7 files before you post them as transmission could corrupt them. but i think this is what your after? addRemove.fp7.zip Edited January 19, 2009 by Guest NEW VERSION
Ocean West Posted January 19, 2009 Posted January 19, 2009 i just updated the sample file - a bit cleaner no need for global variable.
flysurfing Posted January 19, 2009 Author Posted January 19, 2009 Dear LaRetta, Thanks it works now. I did a mistake before. West Ocean, your script looks great, but when i copy it in my database it doesnt seems to work. Could you please tell me if there is any special setup with it ? Thanks
Ocean West Posted January 19, 2009 Posted January 19, 2009 (edited) i think the problem is you are in FMP8 and that doesn't support variables? Edited January 19, 2009 by Guest going from memory - yes 8 does variables.
flysurfing Posted January 19, 2009 Author Posted January 19, 2009 Hello, I am using the fmp 9 Advanced. Shall i work with it ? Thanks
Ocean West Posted January 19, 2009 Posted January 19, 2009 this is how it should work? http://screencast.com/t/f5xh70D7LmJ
flysurfing Posted January 19, 2009 Author Posted January 19, 2009 Dear Ocean West, When i use ur script, nothing happend. I add data in plus or less field an nothing change. What is going wrong ? Could you please have a look to my database i posted it before. Thanks a lot,
Ocean West Posted January 19, 2009 Posted January 19, 2009 no problem I cleaned it up further and this should work for you. tao-samples-stock.fp7.zip
flysurfing Posted January 20, 2009 Author Posted January 20, 2009 Dear Ocean West. Thanks ! Now it works perfectly. Could you please tell me what was the problem ? Thanks
Ocean West Posted January 20, 2009 Posted January 20, 2009 each field sets the variable $qty to it self plus or minus the Quantity then zeros it self out the variable is then set into the Quantity field because of the let statement - any referenced field used in the calculation will trigger the field to be updated.
Recommended Posts
This topic is 5846 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