This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Apr 23, 2016, 6:05 AM
2 Posts

Computed field

  • Category: Other
  • Platform: Windows
  • Release: All
  • Role: Administrator
  • Tags: computed field
  • Replies: 2

Help please

 

I am struggling (beginner level)

 

I have an xpage with a date field which is the date of the most recent inspection which I enter manually

 

I have another field which is the number of days to pass before the next inspection - again I enter manually
 

I need a third (computed) field to work out the date of the next inspection

 

Simple for me in Domino but new to xpages

 

Appreciate your code sample please

 

Thanks

 

Ken

 

 

Apr 23, 2016, 2:59 PM
110 Posts
copy the whole code into an xpage source

<?xml version="1.0" encoding="UTF-8"?>
<xp:view
    xmlns:xp="http://www.ibm.com/xsp/core">
    <xp:table>
        <xp:tr>
            <xp:td>
                <xp:label
                    value="date of the most recent inspection:"
                    id="label1" />
            </xp:td>
            <xp:td>
                <xp:inputText
                    id="inputText1">
                    <xp:dateTimeHelper
                        id="dateTimeHelper1" />
                    <xp:this.converter>
                        <xp:convertDateTime
                            type="date" />
                    </xp:this.converter>
                    <xp:eventHandler
                        event="onchange"
                        submit="true"
                        refreshMode="complete">
                        <xp:this.action><![CDATA[#{javascript:var val1 = getComponent("inputText1").getValue();
var val2 = getComponent("inputText2").getValue();
if (val1 != "" && val1 != null && val2 != "" && val2 != null) {
    getComponent("inputText3").setValue(@Adjust(val1, 0, 0, val2, 0, 0, 0));
}}]]></xp:this.action>
                    </xp:eventHandler>
                </xp:inputText>
            </xp:td>
        </xp:tr>
        <xp:tr>
            <xp:td>
                <xp:label
                    value="number of days to pass before the next inspection:"
                    id="label2" />
            </xp:td>
            <xp:td>
                <xp:inputText
                    id="inputText2">
                    <xp:this.converter>
                        <xp:convertNumber
                            type="number"
                            integerOnly="true" />
                    </xp:this.converter>
                    <xp:eventHandler
                        event="onchange"
                        submit="true"
                        refreshMode="complete">
                        <xp:this.action><![CDATA[#{javascript:var val1 = getComponent("inputText1").getValue();
var val2 = getComponent("inputText2").getValue();
if (val1 != "" && val1 != null && val2 != "" && val2 != null) {
    getComponent("inputText3").setValue(@Adjust(val1, 0, 0, val2, 0, 0, 0));
}}]]></xp:this.action>
                    </xp:eventHandler>
                </xp:inputText>
            </xp:td>
        </xp:tr>
        <xp:tr>
            <xp:td>
                <xp:label
                    value="date of the next inspection:"
                    id="label3" />
            </xp:td>
            <xp:td>
                <xp:inputText
                    id="inputText3"
                    readonly="true"
                    showReadonlyAsDisabled="true">
                    <xp:dateTimeHelper
                        id="dateTimeHelper2" />
                    <xp:this.converter>
                        <xp:convertDateTime
                            type="date" />
                    </xp:this.converter>
                </xp:inputText>
            </xp:td>
        </xp:tr>
    </xp:table>
</xp:view>


This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal