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



Aug 26, 2011, 6:53 AM
4 Posts

View - show single cat. and search

  • Category: Other
  • Platform: Windows
  • Release: 8.5.2
  • Role: Developer
  • Tags:
  • Replies: 7

Hi,

I'm deep frustrated - new to XPage - trying to get simple achivement

I have view - it must be show single category - because contains data for all customer

after login I put to session scope customer Preferredlanguage field value (which is customer UniqeID from normal Lotus form)

so it's easy to display - FILTER BY COLUMN VALUE in first column we use PreferredLanguage field - sorted and categorized

but now I must search this view - but when I add query string via Scoped variables - search put back all results - even those from other cusomer!

  - so Filter by Column value dosen't work after search??

Right now I'm dooing this way - add to search string scoped variable containing customer ID

it's there a simplest way??

the same is when I build my own view - via repeat control and computed field

Best regards

thanks in advance


Aug 28, 2011, 7:27 AM
272 Posts
Re: View - show single cat. and search
Hi,
 
you are right, but this is not a XPages specific thing, it is a standard behaviour of lotus notes that categorization gets lost if you search within a view. You have already found the easiest way to solve your problem: Just add the customer ID to the search, then it works.
 
Sven
Aug 29, 2011, 4:55 AM
26 Posts
Re: View - show single cat. and search
Hi, 
 
Add the customerUniqueID in the FILTER BY CATEGORY NAME to implement show single category in Xpages. Also the search parameters that you capture via sessionscope, should also include the condition you have passed in  FILTER BY CATEGORY NAME. This query would go in the "Search in view results".
 
 
Below is a sample xpage view that you can copy paste on your xpage to understand more clearly. 
 
<xp:viewPanel rows="7" id="viewPanel1" viewStyle="width:100%" rowClasses="tab_raw1, taw_raw2">
<xp:this.facets>
<xp:pager partialRefresh="true" layout="Previous Group Next" xp:key="headerPager" id="pager1" outerStyleClass="text_bluebold"></xp:pager>
</xp:this.facets>
<xp:this.data>
<xp:dominoView var="view1" viewName="vw_xsp_MyRequests">
<xp:this.categoryFilter><![CDATA[#{javascript:@Name("[CN]",@UserName())}]]></xp:this.categoryFilter>
<xp:this.search><![CDATA[#{javascript:var tmpArray = new Array("");
var cTerms = 0;
tmpArray[cTerms++] = "(FIELD txtInitiatorServiceNo = \"" + @Name("[CN]",@UserName()) + "\")";
//if(sessionScope.searchFormName != null & sessionScope.searchFormName != "") {
// tmpArray[cTerms++] = "(FIELD FormName = \"*" + sessionScope.searchFormName + "*\")";
//}
if(sessionScope.searchReqID != null & sessionScope.searchReqID != "") {
tmpArray[cTerms++] = "(FIELD txtFormRequestUNID = \"" + sessionScope.searchReqID + "\")";
}
if(sessionScope.searchFromDate != null & sessionScope.searchFromDate != "") {
var FrmDate = new Date(sessionScope.searchFromDate.toString());
var strDate = FrmDate.getDate();
if (strDate < 10){
strDate = "0" + strDate;
}
var strMnth = (FrmDate.getMonth() + 1);
if (strMnth < 10){
strMnth = "0" + strMnth;
}
tmpArray[cTerms++] = "(FIELD createdDate >= " + strMnth + "/" + strDate + "/" + FrmDate.getFullYear() + ")";
//tmpArray[cTerms++] = "(FIELD createdDate >= \"" + sessionScope.searchFromDate + "\")";
}
if(sessionScope.searchToDate != null & sessionScope.searchToDate != "") {
var ToDate = new Date(sessionScope.searchToDate.toString());
var strDate = ToDate.getDate();
if (strDate < 10){
strDate = "0" + strDate;
}
var strMnth = (ToDate.getMonth() + 1);
if (strMnth < 10){
strMnth = "0" + strMnth;
}
tmpArray[cTerms++] = "(FIELD createdDate <= " + strMnth + "/" + strDate + "/" + ToDate.getFullYear() + ")";
//tmpArray[cTerms++] = "(FIELD createdDate >= \"" + sessionScope.searchToDate + "\")";
qstring = tmpArray.join(" AND ").trim(); 
return qstring // this is what sets the search property
}]]></xp:this.search>
</xp:dominoView>
</xp:this.data>
<xp:this.rendered><![CDATA[#{javascript:getComponent("viewPanel1").getRowCount() > 0}]]></xp:this.rendered>
<xp:viewColumn columnName="FormRequestUNID" id="viewColumn1" style="width:12%;text-align:left" contentType="HTML">
<xp:viewColumnHeader value="Form request i d" id="viewColumnHeader1" styleClass="tab_hd" style="background-image:url(tablehd_bg.jpg)">
</xp:viewColumnHeader>
</xp:viewColumn>
</xp:viewPanel>
 
Hope this helps you. 
 
Regards, 
Yusuf 
Aug 29, 2011, 5:02 AM
26 Posts
Re: View - show single cat. and search
 Also, you could still pass on ur search parameters in Filter by column value
Aug 29, 2011, 8:21 AM
272 Posts
Re: View - show single cat. and search
Hi Yusuf,
 
Sorry, but I can not verify what you are writing.
 
I have create a Form with two fields "Cat" and "Value", and created 4 documents:
1. "Cat": 1, "Value": ABC
2. "Cat": 1, "Value": DEF
3. "Cat": 2, "Value": ABC
4. "Cat": 2, "Value": DEF
 
A view "CatView" with two columns: First Column categorized, field "Cat", second column "Value".
 
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">

    <xp:viewPanel rows="30" id="viewPanel1">
        <xp:this.facets>
            <xp:pager partialRefresh="true" layout="Previous Group Next"
                xp:key="headerPager" id="pager1">
            </xp:pager>
        </xp:this.facets>
        <xp:this.data>
            <xp:dominoView var="view1" viewName="CatView" search="ABC"
                categoryFilter="1">
            </xp:dominoView>
        </xp:this.data>
        <xp:viewColumn columnName="Cat" id="viewColumn1">
            <xp:viewColumnHeader value="Cat" id="viewColumnHeader1"></xp:viewColumnHeader>
        </xp:viewColumn>
        <xp:viewColumn columnName="Value" id="viewColumn2">
            <xp:viewColumnHeader value="Value" id="viewColumnHeader2"></xp:viewColumnHeader>
        </xp:viewColumn>
    </xp:viewPanel>

</xp:view>

 
This shows two entries: "ABC"
 
 
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">

    <xp:viewPanel rows="30" id="viewPanel1">
        <xp:this.facets>
            <xp:pager partialRefresh="true" layout="Previous Group Next"
                xp:key="headerPager" id="pager1">
            </xp:pager>
        </xp:this.facets>
        <xp:this.data>
            <xp:dominoView var="view1" viewName="CatView" search="ABC"
                keys="1">
            </xp:dominoView>
        </xp:this.data>
        <xp:viewColumn columnName="Cat" id="viewColumn1">
            <xp:viewColumnHeader value="Cat" id="viewColumnHeader1"></xp:viewColumnHeader>
        </xp:viewColumn>
        <xp:viewColumn columnName="Value" id="viewColumn2">
            <xp:viewColumnHeader value="Value" id="viewColumnHeader2"></xp:viewColumnHeader>
        </xp:viewColumn>
    </xp:viewPanel>

</xp:view>
 
 
This shows two entries: "ABC"
 
There is no difference, in both cases the categorization gets lost.
 
But in your code you are searching for the username, maybe this is why the categoryFilter seems to work.
 
...
<xp:this.categoryFilter><![CDATA[#{javascript:@Name("[CN]",@UserName())}]]></xp:this.categoryFilter>
<xp:this.search><![CDATA[#{javascript:var tmpArray = new Array("");
var cTerms = 0;
tmpArray[cTerms++] = "(FIELD txtInitiatorServiceNo = \"" + @Name("[CN]",@UserName()) + "\")";
...
 
 
Am I right?
 
 
Sven
Aug 31, 2011, 6:42 AM
26 Posts
Re: View - show single cat. and search
 Hi Sven,
 
In our application, each user creates documents and when that user logs in, he should see only his documents. To achieve this, we have single view listing all the documents  created using that form and the first column is the common name of the creator (which is saved in a field on the document). In the viewpanel, I therefore pass the common name of the logged in user as a filter to that category and it displays only those documents which are created by the logged in user.
 
As per what I understood of the issue in this thread was that the thread owner was able to display the documents filtering on the category as I stated  above. The thread owner than searches the view based on some search keywords and the search results displays all the documents matching the search criteria (even those that he had not created). My suggestion was to also pass the logged in user common name (the field value that is used to filter the view) to the search parameters and restrict the search result. 
 
Hope I am able to explain the scenario. 
 
Do let me know if I have mis-understood any part of it. 
 
Thanks for your time. Your comments to others threads have help me in the past. 
 
Regards, 
Yusuf 
Aug 31, 2011, 9:41 AM
272 Posts
Re: View - show single cat. and search
Hi Yusuf,
 
In my opinion, you can remove the category filter of your view, because it has no effect to the result. If a user opens the view you described in your posting without adding a search term, the search term looks like this:
 
 AND (FIELD txtInitiatorServiceNo = "Sven Hasselbach")
 
The search term in your view will never be empty.

Sven
Sep 1, 2011, 5:20 AM
26 Posts
Re: View - show single cat. and search
 Hi Sven,
 
Ya I do agree with you. I had realized it lately but still to update the viewpanel control. 
 
Thanks :D 
Yusuf 

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