Skip to main content

Posts

Showing posts with the label Dynamics AX 2012 R2 SysDateLookup returning a week number

Returning a weeknumber from the standard calendar lookup form

A customer had a requirement for setting a week number for approximate delivery of purchased goods on shipment as an indication for the sales department of when the goods will be arriving. An integer field had been introduced on the table in question, and the customer wanted to be able to do a lookup in the standard calendar, but wanted a week number to be returned in stead of a date. I solved it like this: 1. For the field that was to contain ETAWeek there was an Extended Data Type called ETAWeek. On the EDT I put SysDateLookup in the FormHelp property 2. In the Form SysDateLookup I added a boolean variable in Classdeclaration. boolean calledFromIntegerField; 3. In the Form SysDateLookup - method init I added check to see if the SysDateLookup form was called from an integer form control. if (formRun.selectedControl() is FormIntControl)      calledFromIntegerField = true; 4.In the Form SysDateLookup - method closeSelect I added an extra else if block in the bottom to handle