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



Oct 12, 2011, 3:21 PM
5 Posts

Simple Repeat Control question

  • Category: Server Side JavaScript
  • Platform: Windows
  • Release: 8.5.2
  • Role: Developer
  • Tags:
  • Replies: 2
This is driving me batty, but it's pretty simple, so it must be something I'm missing.  I removed everything complex from my page, and still can't get it to work.
 
In this source below, computedfield3 is giving me 'doc is null' errors.  Computedfield2 is fine, and displays the correct date format, so I know I'm able to access my collection ('rowData').  Why does this fail:
 
var doc:NotesDocument = rowData.getDocument();
doc.getItemValueString("sched_location")
 
Long-time LS developer, new to xpages, but I thought a 'getDocument' would return me a valid document object that I could run a getItemValueString on to pull a value.  I have workarounds, but eventually I will need to get a handle on the doc object to modify and save it.  Can someone give me a hint?
 
SOURCE
 
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
    <xp:this.data>
        <xp:dominoView var="view1" viewName="by Week Ending"></xp:dominoView>
    </xp:this.data>

    <xp:repeat id="repeat1" rows="30" value="#{view1}" var="rowData">
        <xp:panel>
            <xp:this.data>
                <xp:dominoView var="view2" viewName="by Week Ending"></xp:dominoView>
            </xp:this.data>
            
            <xp:br></xp:br>
            
        <xp:text escape="true" id="computedField1" value="#{rowData.sched_age}">
                        </xp:text><xp:br></xp:br><xp:text escape="true" id="computedField2" value="#{rowData.sched_name}"></xp:text><xp:br></xp:br><xp:inputText id="inputText1" value="#{rowData}"><xp:this.defaultValue><![CDATA[#{javascript:var sdt:NotesDateTime = rowData.getColumnValue( "MonStartFull" );
var edt:NotesDateTime = rowData.getColumnValue( "MonEndFull" );
var tempS = rowData.getColumnValue( "MonStart" );
var tempL = rowData.getColumnValue( "sched_location");

if (tempS == '' ) {
    'Off'
}else{
    var shrs = sdt.getHours();
    var smins = sdt.getMinutes();
    var ehrs = edt.getHours();
    var emins = edt.getMinutes();
    if (shrs > 12){
        shrs = shrs - 12;
        var spmFlag = 'pm';
    }    
    if (ehrs > 12){
        ehrs = ehrs - 12;
        var epmFlag = 'pm';
    }
    if (emins == 0){
        emins = ''
    }else{
        emins = ':' + emins
    }
    if (smins == 0){
        smins = ''
    }else{
        smins = ':' + smins
    }
    
    shrs + smins + spmFlag + '-' + ehrs + emins + epmFlag + ' ' + tempL;
}

}]]></xp:this.defaultValue></xp:inputText>
            <xp:br></xp:br>
        
        <xp:br></xp:br>
        
        <xp:text escape="true" id="computedField3"><xp:this.value><![CDATA[#{javascript:
var doc:NotesDocument = rowData.getDocument();
doc.getItemValueString("sched_location")}]]></xp:this.value></xp:text></xp:panel>
    </xp:repeat>
</xp:view>

Oct 12, 2011, 3:32 PM
149 Posts
Re: Simple Repeat Control question
 
This might help
 
- why is there two view data sources? (might be right, I did not really uderstand what was going on by reading the xml)
- is the view categorized?
- add try/catch 
- add if(doc) before getting the value
 
 
hope it helps
Thomas
Oct 13, 2011, 1:06 PM
5 Posts
Re: Simple Repeat Control question
Thanks for the tip.  I'm only using one view, so not sure how that second source got there.
 
I just started again from scratch and now my code works fine!:)  Maybe it was some leftover code in the source from all my experimenting that was causing the issues.
 
Anyway, hope that helps someone else!

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