Jump to content
Server Maintenance This Week. ×

Field calculation


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

Recommended Posts

  • Newbies

Hello all -

Another question. I have a layout setup the following way... 3 fields. field 1 is a price, field 2 is a sale price, field 3 is a % off the original price.

What I would like to have happen is - a user enters a price in field 1, then if the user enters a sale price in field 2, the percent is automatically calculated and entered in field 3. On the other hand, if the user enters a percent in field 3, the sale price is automatically calculated and entered in field 2.

I am stuck here because I seem to be able to only have it work in one direction. In order to make it work one of the fields needs to be result, which then makes it uneditable. I am sure there must be a way to do this but I am really new at this and would appreciate any help anyone can give me. smile.gif

Thanks in advance

-John

Link to comment
Share on other sites

quote:

Originally posted by jfountain:

Hello all -

Another question. I have a layout setup the following way... 3 fields. field 1 is a price, field 2 is a sale price, field 3 is a % off the original price.

What I would like to have happen is - a user enters a price in field 1, then if the user enters a sale price in field 2, the percent is automatically calculated and entered in field 3. On the other hand, if the user enters a percent in field 3, the sale price is automatically calculated and entered in field 2.

I am stuck here because I seem to be able to only have it work in one direction./B]

You need more fields.

Price_data

Sales Price_data

Percentage_calc

Percentage_data

Sales Price_calc

Percentage_calc = IF ( IsEmpty(Percentage_data), Sales Price_data/Price_data, Percentage_data)

Sales Price_calc = IF ( not IsEmpty(Percentage_data), Price_data * Percentage_data, Sales Price_data)

So this way if you enter data into the Percentage_data field, the sales price will be calculated, if you do not enter data into the Percentage_data field, then the percentage will be calculated.

You put the Price_data, Sales Price_data and Percentage_data fields on your layout as normal. Then lay the Sales Price_calc field on top of the Sales Price_data field. Give it a fill color (of your choice) and make it not enterable. Do this same thing with the Percentage_calc field.

This will result in you seeing what is in the two calc fields, but when you click on them you are actually editing the data fields.

------------------

=-=-=-=-=-=-=-=-=-=-=-=-=

Kurt Knippel

Consultant

Database Resources

mailto:[email protected]

http://www.database-resources.com

=-=-=-=-=-=-=-=-=-=-=-=-=

Link to comment
Share on other sites

  • Newbies

Thanks so much Kurt- I was heading down that exact road when I read your reply. I couldn't get it to work because I was trying to make the top field invisible and let the bottom one show through. making the field uneditable did the trick though. I don't think I would have figured that out without your help! Thankis again!

-John

Link to comment
Share on other sites

This topic is 8478 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.