chattavegas Posted March 10, 2005 Author Posted March 10, 2005 I want to auto-enter a number value based on if a date falls with a specific date range. For instance, if the date is between July 1, 1980 and June 30, 1990, the value should be $25.00, if the date is between July 1, 1970 and June 30, 1980, the value should be $20.00, etc, etc. I tried this, but it doesn't seem to work (v_Date is the variable) : Case ( v_Date ? "7/1/1980" and v_Date ? "6/30/1990", "25.00", v_Date ? "7/1/1970" and v_Date ? "6/30/1980", "20.00") Also, does it matter if v_Date is a global field or not? -Scott
chattavegas Posted March 10, 2005 Posted March 10, 2005 I want to auto-enter a number value based on if a date falls with a specific date range. For instance, if the date is between July 1, 1980 and June 30, 1990, the value should be $25.00, if the date is between July 1, 1970 and June 30, 1980, the value should be $20.00, etc, etc. I tried this, but it doesn't seem to work (v_Date is the variable) : Case ( v_Date ? "7/1/1980" and v_Date ? "6/30/1990", "25.00", v_Date ? "7/1/1970" and v_Date ? "6/30/1980", "20.00") Also, does it matter if v_Date is a global field or not? -Scott
chattavegas Posted March 10, 2005 Author Posted March 10, 2005 I want to auto-enter a number value based on if a date falls with a specific date range. For instance, if the date is between July 1, 1980 and June 30, 1990, the value should be $25.00, if the date is between July 1, 1970 and June 30, 1980, the value should be $20.00, etc, etc. I tried this, but it doesn't seem to work (v_Date is the variable) : Case ( v_Date ? "7/1/1980" and v_Date ? "6/30/1990", "25.00", v_Date ? "7/1/1970" and v_Date ? "6/30/1980", "20.00") Also, does it matter if v_Date is a global field or not? -Scott
RalphL Posted March 10, 2005 Posted March 10, 2005 Auto enter happens when a record is created. Try making this a calculated field. I assume the ?'s are >= & <=. Also your numbers should not be in quotes and the trailing zeros are unnecessary.
RalphL Posted March 10, 2005 Posted March 10, 2005 Auto enter happens when a record is created. Try making this a calculated field. I assume the ?'s are >= & <=. Also your numbers should not be in quotes and the trailing zeros are unnecessary.
RalphL Posted March 10, 2005 Posted March 10, 2005 Auto enter happens when a record is created. Try making this a calculated field. I assume the ?'s are >= & <=. Also your numbers should not be in quotes and the trailing zeros are unnecessary.
chattavegas Posted March 10, 2005 Author Posted March 10, 2005 I eliminated the quotes and made it a calculated field, and it still doesn't work. Any other thoughts? Also, here's the current calc: Case ( v_Date >= 7/1/1980 and v_Date <= 6/30/1990, "25", v_Date >= "7/1/1970" and v_Date <= "6/30/1980", "20" ) -Scott
chattavegas Posted March 10, 2005 Author Posted March 10, 2005 I eliminated the quotes and made it a calculated field, and it still doesn't work. Any other thoughts? Also, here's the current calc: Case ( v_Date >= 7/1/1980 and v_Date <= 6/30/1990, "25", v_Date >= "7/1/1970" and v_Date <= "6/30/1980", "20" ) -Scott
chattavegas Posted March 10, 2005 Author Posted March 10, 2005 I eliminated the quotes and made it a calculated field, and it still doesn't work. Any other thoughts? Also, here's the current calc: Case ( v_Date >= 7/1/1980 and v_Date <= 6/30/1990, "25", v_Date >= "7/1/1970" and v_Date <= "6/30/1980", "20" ) -Scott
mr_vodka Posted March 10, 2005 Posted March 10, 2005 Try this. Case( v_Date >= TextToDate("07/01/1980") and v_Date <= TextToDate("06/30/1990") , 25, v_Date >= TextToDate("07/01/1970") and v_Date <= TextToDate("06/30/1980"), 20)
mr_vodka Posted March 10, 2005 Posted March 10, 2005 Try this. Case( v_Date >= TextToDate("07/01/1980") and v_Date <= TextToDate("06/30/1990") , 25, v_Date >= TextToDate("07/01/1970") and v_Date <= TextToDate("06/30/1980"), 20)
mr_vodka Posted March 10, 2005 Posted March 10, 2005 Try this. Case( v_Date >= TextToDate("07/01/1980") and v_Date <= TextToDate("06/30/1990") , 25, v_Date >= TextToDate("07/01/1970") and v_Date <= TextToDate("06/30/1980"), 20)
-Queue- Posted March 10, 2005 Posted March 10, 2005 Just to note, Date( 7, 1, 1980 ) is more reliable than TextToDate("7/1/1980") since it doesn't rely on system or regional settings.
-Queue- Posted March 10, 2005 Posted March 10, 2005 Just to note, Date( 7, 1, 1980 ) is more reliable than TextToDate("7/1/1980") since it doesn't rely on system or regional settings.
-Queue- Posted March 10, 2005 Posted March 10, 2005 Just to note, Date( 7, 1, 1980 ) is more reliable than TextToDate("7/1/1980") since it doesn't rely on system or regional settings.
chattavegas Posted March 11, 2005 Author Posted March 11, 2005 Yes, that works! The winning calc is as follows: Case( v_Date >= Date(7,1,1980) and v_Date <= Date(6,30,1990), "25", v_Date >= Date(7,1,1970) and v_Date <= Date(6,30,1980), "20") Thanks for all the responses, -Scott
chattavegas Posted March 11, 2005 Author Posted March 11, 2005 Yes, that works! The winning calc is as follows: Case( v_Date >= Date(7,1,1980) and v_Date <= Date(6,30,1990), "25", v_Date >= Date(7,1,1970) and v_Date <= Date(6,30,1980), "20") Thanks for all the responses, -Scott
chattavegas Posted March 11, 2005 Author Posted March 11, 2005 Yes, that works! The winning calc is as follows: Case( v_Date >= Date(7,1,1980) and v_Date <= Date(6,30,1990), "25", v_Date >= Date(7,1,1970) and v_Date <= Date(6,30,1980), "20") Thanks for all the responses, -Scott
-Queue- Posted March 11, 2005 Posted March 11, 2005 Note also that your numeric results need not be in quotes since they are not textual. It will not hurt if they are though.
-Queue- Posted March 11, 2005 Posted March 11, 2005 Note also that your numeric results need not be in quotes since they are not textual. It will not hurt if they are though.
-Queue- Posted March 11, 2005 Posted March 11, 2005 Note also that your numeric results need not be in quotes since they are not textual. It will not hurt if they are though.
Recommended Posts
This topic is 7265 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