Summary

This command converts a date or string to a partial date.  

Table of Contents


The first parameter is the object to convert to a partial date (either string or date), and the second parameter is the partial date format(optional).

Attributes

  • adjust (optional) – provides the ability to force all unknown portions of a Partial Date to the lowest or highest possible values. The default (none) is partially equivalent to the ‘min’ values with the exception that for comparison purposes, unknown portions are considered to be equivalent to some of the known portions of the date they are being compared against.

Examples with the adjustment as ‘none’

Unknown DateComparing AgainstUnknown Calculated As
UNK/Feb/201616/Feb/201601/Feb/2016
UNK/UNK/201616/Feb/201601/Jan/2016
UNK/UNK/UNK16/Feb/201601/Jan/2016

Examples with the adjustment as ‘min’

Unknown DateComparing AgainstUnknown Calculated As
UNK/Feb/201616/Feb/201601/Feb/2016
UNK/UNK/201616/Feb/201601/Jan/2016
UNK/UNK/UNK16/Feb/201601/Jan/2016 *

* – The year is equivalent to the comparison date’s year, but set to 1900 if not used in comparison.

Examples with the adjustment as ‘max’

Unknown DateComparing AgainstUnknown Calculated As
UNK/Jul/201616/Feb/201631/Jul/2016 *
UNK/UNK/201616/Feb/201630/Dec/2016 **
UNK/UNK/UNK16/Feb/201630/Dec/2016 ***

* – Day is the maximum day of the month if the month is set, otherwise defined as 30 if the month is unset.

** – Month is December, max day is always defined as 30 if the month is unset.

*** – The year is equivalent to the comparison date’s year, but set to 2200 if not used in comparison.

The following tables provides the min and max values:

  • none – this is the default value and it does not apply any adjustments to the provided date
  • min – forces the date provided to the minimum values for all portions of the date:
Year1900
Month1
Day of Month1
Hour0
Minute0
Second0
Millisecond0
  • max – forces the date provided to the maximum values for all portions of the date:
Year2200
Month12
Day of MonthLast Day of the Month
Hour23
Minute59
Second59
Millisecond999

Parameters

  • one string or date command
  • one string command

Example

<script scriptId="prior_dobCk">
    <body>
        <s:alert>
            <s:expression>
                <s:or>
                    <s:not>
                        <s:isSet/>
                    </s:not>
                    <s:not>
                        <s:isSet>
                            <s:question>
                                <s:question path="/screening/dm.dob_"/>
                            </s:question>
                        </s:isSet>
                    </s:not>
                    <s:gte>
                        <s:partialDatePath path=":value"/>
                        
                        <s:toPartialDate>
                            <s:datePath path="/screening/dm.dob_:value"/>
                            <s:string value="dd[]/MMM[]/yyyy[]"/>
                        </s:toPartialDate>
                        
                    </s:gte>
                </s:or>
            </s:expression>
            <s:correction>
                <s:string value="optional"/>
            </s:correction>
            <s:text>
                <s:string value="This date is before the date of birth. Please 
                clarify."/>
            </s:text>
        </s:alert>
    </body>
    <target typeId="strtdt2_" when='preprocess' shouldReconcile='true'/>
    <target typeId="enddt_" when='preprocess' shouldReconcile='true'/>
    <target typeId="strtdtcm" when='preprocess' shouldReconcile='true'/>
    <target typeId="strtdtcm2" when='preprocess' shouldReconcile='true'/>
    <dependent path="/screening/dm.dob_"/>
</script>

Example With Adjustment Attribute

<script scriptId="prior_dobCk">
    <body>
        <s:alert>
            <s:expression>
                <s:or>
                    <s:not>
                        <s:isSet/>
                    </s:not>
                    <s:not>
                        <s:isSet>
                            <s:question>
                                <s:question path="/screening/dm.dob_"/>
                            </s:question>
                        </s:isSet>
                    </s:not>
                    <s:gte>
                        <s:partialDatePath path=":value"/>
                        
                        <s:toPartialDate adjust="min" >
                            <s:datePath path="/screening/dm.dob_:value"/>
                            <s:string value="dd[]/MMM[]/yyyy[]"/>
                        </s:toPartialDate>
                        
                    </s:gte>
                </s:or>
            </s:expression>
            <s:correction>
                <s:string value="optional"/>
            </s:correction>
            <s:text>
                <s:string value="This date is before the date of birth. Please 
                clarify."/>
            </s:text>
        </s:alert>
    </body>
    <target typeId="strtdt2_" when='preprocess' shouldReconcile='true'/>
    <target typeId="enddt_" when='preprocess' shouldReconcile='true'/>
    <target typeId="strtdtcm" when='preprocess' shouldReconcile='true'/>
    <target typeId="strtdtcm2" when='preprocess' shouldReconcile='true'/>
    <dependent path="/screening/dm.dob_"/>
</script>



Need more help?

Please visit the Fountayn Contact Information page.