I have search the forum, but I'm not able to identify anything that specifically answers my script question.
I would like to create a custom calculation script using information stored in a field. The field is a text field formatted as a date "mm/dd/yyyy"
I'm trying to create a monthly straight line trend.
User Input Date: 01/10/2014 (Month/Day/Year); cannot be driven by current system date, must be user entered
Units to Date: 10 Units
Monthly Straight Line Trend is 31 units (This is what I would like to calculate)
Formula = (Units/Day)*Max Days of Month
To accomplish my goal, I need to solve for the following hangups:
1) Can I extract the "Day" from the date text field?
2) Can I derive the "Max" number of days in a given Month/Year?
3) Can I tie the script together so I don't need to have a "DAY" text field and a "MAX DAY" text field?
Any help would be very much appreciated.
1) Yes, if you convert the date string to a JS date object you can use the date method getDate() to get the day of the month from the date object.
2) Yes, there are many ways to compute this value.
3} JS supports variables so it may come down to programing skillls.
I'm glad to hear it's conceivable. Any chance I can get some help writing the script or atleast a sample of something similar that I can dissect?