Skip to Content mrc logo mrc logo
  • What is m-Power?
    Overview Demos Build Process Case Studies Specs Pricing Trial
    m-Power Resources
    Overview How-To Videos Webinars & Podcasts White Papers Fact Sheets
  • What does m-Power build?
    Overview Database Front-Ends Reporting CRM Systems Business Intelligence Dashboards Inventory Management Mobile Apps ERP Enhancements Modernization Spreadsheets to the Web MS Access to the Web B2B/Web Portals Scheduling Embedded Analytics Web Forms Workflow Data Exploration Budgeting & Forecasting APIs & Web Services Db2 Web Query Alternative
    Solutions by Industry
    Overview Manufacturing Government Foodservice Software Vendors Logistics & Supply Chain Software Consultants Healthcare
  • Development Services Training Mentoring
  • Overview Partners Press Releases Careers Events Contact Blog
  • Support Home FAQ Documentation Customer Portal Enhancements Updates Roadmap Techblog
Try m-Power

m-Power Manual

Browse:

  • Home
  • Deprecated Documentation
  • Add/Subtract Dates using the Java Date Translator
Back to Manual

Add/Subtract Dates using the Java Date Translator

**Note: This Feature Has Been Deprecated.

Please use this link to find alternative features:

https://www.mrc-productivity.com/techblog/?p=522

 

 

The Java Date Translator is a very powerful tool, commonly used to determine the difference between two dates (Most date conversion can now be accomplished with a UDF). However, there is an often overlooked feature that has proved to be useful to a number of our clients, the "Add/Subtract" parameter. This parameter allows for the developer to create a logical date field based off of a difference of years, months or days. So, when would someone want to use this feature? Let's say that we need to review all of the sales for the six previous months. Each salesman who has sold over a certain amount over this six month range will be awarded a bonus. We can even take the scenario one step further; say that this award is given out every month making it a rolling six month date range. Let's see how this is accomplished.

In our example the goal is to create two date fields, one that will return today's date and one to return a date six months prior. The first step is to create a calculation that calls the Java Date Translator to retrieve today's date. I will create my calculation with the attributes of 8,0 in yyyymmdd format (you will be able to use any field attributes for the available Output/Input parameters).

Setting my calc to the Output/Input: 8.0 format (*YMD8 yyyymmdd) format.

Step 2 is to create a calculation with the attributes of 4,0 for the Add/Subtract function and set the value to the amount of months/days/years you would like added/subtracted from the current date (example: -6). All Java Date Translator parameters require a field of 4,0 for subtraction/addition.

Next we will need to create our final calculation. The attributes of this calculation should match your first calculation (in this case 8,0) and call the Java Date Translator object again. This time we're going to utilize three parameters.

The first parameter is an input that calls our first calculation. Remember, CALCULA001 will retrieve today's date.

The second parameter will utilize the 'Input: Add/Subtract Month On Input Date' parameter to subtract the number of months from CALCULA001.

For the last parameter we will call the current calculation. This will use the other parameters to compute and display the new desired date.

We are almost finished! From here, all we need to do is build and compile our application. When run, the application output will look something like the screen shot below. You can see that the application is correctly displaying columns for today's date (calculation 1) and the new date (calculation 3) providing us with the desired 6 month date range.

Created: October 24, 2008 | Modified: October 26, 2013

Search


Browse By Category

Build Process (13)
Starting with m-Power (8)
Retrievals (10)
Reports (15)
Summaries (4)
Maintainers (17)
Graphs (8)
m-Power Data Explorer (4)
General (24)
Calculations (5)
Utilities (9)
m-Power Administration (23)
Security (11)
Freemarker (6)
m-Painter (29)
Form Validation (5)
External Objects & UDFs (12)
Deprecated Documentation (23)
Bootstrap Templates (7)

Popular Tags

Getting Started Parameters Reports Bootstrap Templates Bar Graphs SQL m-Painter Database Retrievals Application Properties Summaries Report Popular RPG Advanced Administration External Objects Form Validation Maintainer Performance Dropdowns Calculations Compiling Tomcat Retrieval Video Excel Graph Properties Java Admin Production Graphing Email Data Dictionary Build Process Security DB2 Freemarker App Properties Prompt Screens Maintainers mrc-Productivity Series Graphs Dates Record Selections

See all tags »

michaels, ross & cole, ltd. (mrc)

Privacy Policy Cookie Policy Cookie Settings Notice at Collection Do Not Sell or Share My Personal Information

mrc (US)

2001 Midwest Road
Suite 310
Oak Brook, IL 60523
630-916-0662

mrc (UK)

Mortlake Business Centre
20 Mortlake High Street
London, SW14 8JN
+44-20-335-59566


© mrc. All rights reserved.