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



May 15, 2013, 12:30 PM
10 Posts
topic has been resolvedResolved

Problems with search and date fields

  • Category: Other
  • Platform: All
  • Release: 8.5.3
  • Role: Developer
  • Tags:
  • Replies: 4
Hi

I use this code in "Search in view results". If a only use FIELD Site its work great but when i select date a get this error "Query is not understandable".

The field is a date field (StartDate) in room/resources database. Some suggestions

--------------------------------------------------
StartDate field
--------------------------------------------------
<xp:inputText id="inputText1" value="#{viewScope.sDate}">
        <xp:this.converter>
            <xp:convertDateTime pattern="MM/dd/yyyy"></xp:convertDateTime>
        </xp:this.converter>
        <xp:eventHandler event="onchange" submit="true"
            refreshMode="complete">
            <xp:this.action><![CDATA[#{javascript:viewScope.sDate}]]></xp:this.action>
        </xp:eventHandler>

        <xp:dateTimeHelper></xp:dateTimeHelper>
    </xp:inputText>   
 
--------------------------------------------------
CODE VIEW SEARCH
-------------------------------------------------- 
var tmpArray = new Array("");
var cTerms = 0;

if(viewScope.fong != null & viewScope.fong != "") {
    tmpArray[cTerms++] = "(FIELD Site = \"" + viewScope.fong + "\")"
}
if(@Text(viewScope.sDate) != null & @Text(viewScope.sDate) != "") {
    tmpArray[cTerms++] = "(FIELD StartDate = \"" + @Text(viewScope.sDate) + "\")"
}

qstring = tmpArray.join(" AND ").trim();

viewScope.queryString = qstring;

return qstring 
 
 
May 16, 2013, 3:03 AM
453 Posts
Re: Problems with search and date fields
Look here:


http://www-10.lotus.com/ldd/xpagesforum.nsf/topicThread.xsp?action=openDocument&documentId=FBF6FEEFBE38536F85257B6A0057A308


I was having the same problem as you were. The date lookup in SSJS in the Search in view property is different from the Notes FT Index syntax.

   
May 16, 2013, 9:40 AM
10 Posts
Re: Problems with search and date fields
Now a get this error

Error while executing JavaScript computed expression
Script interpreter error, line=19, col=33: Unknown member 'getDateOnly' in Java class 'java.util.Date'

JavaScript code

   1: var tmpArray = new Array("");
   2: var cTerms = 0;
   3: 
   4: //####################################################
   5: //TEXT VALUE (Site)
   6: //####################################################
   7: 
   8: if(viewScope.fong != null & viewScope.fong != "") {
   9: 	tmpArray[cTerms++] = "(FIELD Site = \"" + viewScope.fong + "\")"
  10: }
  11:
  12: 
  13: //#####################################################
  14: //DATE VALUE (StartDate)
  15: //#####################################################
  16: 
  17: if(viewScope.sDate != null & viewScope.sDate != "") {
  18: 	var dt:NotesDateTime = viewScope.sDate;
  19: 	var dString:String = dt.getDateOnly();
  20: 	tmpArray[cTerms++] = "FIELD StartDate  =  "  + dString 
  21: }
  22: 
  23: return qstring = tmpArray
  24: qstring = tmpArray.join(" AND ").trim();
  25: viewScope.queryString = qstring;
  26: 
  27: return qstring
 ________________


FIELD with viewScop.sDate

<xp:inputText id="sDate" value="#{viewScope.sDate}">
        <xp:this.converter>
            <xp:convertDateTime type="date" dateStyle="short"></xp:convertDateTime>
        </xp:this.converter>
        <xp:eventHandler event="onchange" submit="true"
            refreshMode="complete">
            <xp:this.action><![CDATA[#{javascript:viewScope.sDate}]]></xp:this.action>
        </xp:eventHandler>

        <xp:dateTimeHelper></xp:dateTimeHelper>
    </xp:inputText>   

________________

FIELD    with viewScope.fong

<xp:comboBox id="comboBox1" value="#{viewScope.fong}">
        <xp:selectItem itemLabel="Välj förvaltning"></xp:selectItem>
        <xp:selectItems>
            <xp:this.value><![CDATA[#{javascript:var result = @DbColumn(@DbName(), ".ResPerFong", 11);
(typeof result == "string") ? "No result" : @Trim(@Unique(result))}]]></xp:this.value>
        </xp:selectItems>

        <xp:eventHandler event="onchange" submit="true"
            refreshMode="complete">
            <xp:this.action><![CDATA[#{javascript:viewScope.fong}]]></xp:this.action>
        </xp:eventHandler>


    </xp:comboBox> 

  
May 16, 2013, 10:44 PM
453 Posts
Re: Problems with search and date fields
the scope variable is not of the type NotesDateTime so you do a dt.getDateOnly from it. If your scopeVariable is already type string and I'm guessing contains just the date.

I think that you could use this:

var dt:NotesDateTime = session.createDateTime(sessionScope.sDate); 

Now dt is NotesDatTime item and you can then get the values from it.   

but none of this may be necessary because I'm guessing the sessionScope.sDate is just the date string "05/20/2013" already. 
May 23, 2013, 9:22 AM
10 Posts
Re: Problems with search and date fields
Thanks for the help, sometimes I make it harder than necessary.

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