FORUM PLAN UPDATE
Date revision: This forum will remain open to new posts and responses until December 1, 2018. (After that date, you will still be able to view and search the forum.) Also, we're taking a second look at the best place to host future conversation. For now, keep using this forum, and stay tuned for more news.



Jan 27, 2015, 10:11 AM
93 Posts
topic has been resolvedResolved

viewCategoryColumn

  • Category: Other
  • Platform: Windows
  • Release: 9.0.1
  • Role: Developer
  • Tags:
  • Replies: 23

Hi guys,

I have a view, which works and looks fine, shows expandable category as I need.

 

However, when I filter results by column value, although it returns the correct documents, it no longer shows them categorized, and only as one list of results (I guess its doing a FTSearch maybe?)

 

Is there anyway to use filter by column value AND retain the categorized column I have?

 

Sample code here:

 

Thanks

 

<xe:this.data>
              <xp:dominoView var="view_EVIndicationsByObligorNo"
                  viewName="(lkupEVIndicationsByObligorNo)"
                  sortOrder="ascending">
                  <xp:this.sortColumn>
                      #{javascript:viewScope.get("sortingColumn");}
                  </xp:this.sortColumn>
                  <xp:this.search><![CDATA[#{javascript:viewScope.get("searchValue");}]]></xp:this.search>
                  <xp:this.databaseName><![CDATA[#{javascript:try{

var fileName:string = "protocasebook.nsf";

var db:NotesDatabase = session.getDatabase("", fileName, false);
//print("DB: " + db.getTitle());
return db;

}
catch(e){
    print("Error getting Enquiry book view: " + e);
}    
}]]></xp:this.databaseName>

                  <xp:this.keys><![CDATA[#{javascript:print("Sess: " + viewScope.ObligorNo);
return viewScope.ObligorNo;
}]]></xp:this.keys>
              </xp:dominoView>
          </xe:this.data>
          <xe:this.categoryColumn>
          <xe:viewCategoryColumn columnName="$30" styleClass="" />      
          </xe:this.categoryColumn>
          <xe:this.summaryColumn>         
          
            <xe:viewSummaryColumn columnTitle="" columnName="ObligorNo"
                styleClass="" headerStyleClass="">
                <xe:this.converter>
                    <xp:convertNumber integerOnly="true"></xp:convertNumber>
                </xe:this.converter>
            </xe:viewSummaryColumn>
          </xe:this.summaryColumn>
         
         <xe:this.extraColumns>
            <xe:viewExtraColumn columnName="UWname"
                                columnTitle="UWname"
                                styleClass=""
                                headerStyleClass=""
                                loaded="false"/>
         </xe:this.extraColumns>
         <xe:this.extraColumns>
            <xe:viewExtraColumn columnName="$21"
                                columnTitle="UW Response"
                                styleClass=""
                                headerStyleClass=""
                                loaded="false"/>
         </xe:this.extraColumns>
         <xe:this.extraColumns>
            <xe:viewExtraColumn columnName="Rate"
                                columnTitle="Rate"
                                styleClass=""
                                headerStyleClass=""
                                loaded="false"/>
         </xe:this.extraColumns>
         <xe:this.extraColumns>
            <xe:viewExtraColumn columnName="Line"
                                columnTitle="Line"
                                styleClass=""
                                headerStyleClass=""
                                loaded="false"/>
         </xe:this.extraColumns>
         <xe:this.extraColumns>
            <xe:viewExtraColumn columnName="EnquiryNo"
                                columnTitle="EnquiryNo"
                                styleClass=""
                                headerStyleClass=""
                                loaded="false"/>
         </xe:this.extraColumns>
      </xe:dataView>
   </xp:panel>

 

 

Jan 27, 2015, 6:04 PM
453 Posts
Think this is the way it works

I found I had a lot of trouble getting this sort of thing to work correctly, I have ended up scraping the process and using a repeat control. With repeats I have been able to get around (with a bit of code) these issues. I have some code that navigates a navigator object and returns just the categories that I store in a viewScope and bind my first level repeat to that. Then with +/- buttons I get the documents under the category only when I need them. I have worked through this with a pretty large DB and found response times to be very good.

Sorry I can't help with your specific problem, someone else might have an answer as to how to accomplish this in your specific case.

Jan 29, 2015, 7:58 AM
589 Posts
Hmm

 

as Bill says... I suggest to use nested repeats.  You get much more control and can do anything you want really.

 

Jan 29, 2015, 9:43 AM
93 Posts
Nested Repeat

Thanks for the pointers guys,

 

David - I used the code from your repeat2 page on the xpagescheatsheet demo site as a starting point, modified and styled to my needs and it is working nicely.

 

The only issue I have is my first category is returning a @dbcolumn, and so its showing ALL categories, then when I expand each category it shows (correctly) the documents using a viewScope variable in getAllEntriesByKey. Except it shows the same subset of documents for each category.

 

A minor issue for me to resolve, but in principal it is doing what I need it to so thanks both.

Jan 29, 2015, 12:02 PM
453 Posts
When you go to the repeat you will need ...

.. to add some code that creates the first category and because you are working with a subset of the data and the @DBColumn does not know that it goes back to the full data set. I have a repeat that that returns the results of a fairly involved FTSearch. In my case I do :

ar vw:NotesView = thisAppDB.getView("vwFTSearch")

var n:Integer = vw.FTSearchSorted(qString, 0 , "SortBy" , false, false, false, false );

the vwFTSearch has a column "SortBy" which is a computed column that looks like this:

Field1 + "~" + Field2

Field1 is the value I want to use for my first Category and Field2 is the order I want the documents sorted by under that category - say a date or ????. I make the view Categorized by the SortBy column. Now I need to cycle through the documents and build an array uniques array of Field2 values and store that in a viewScope.Cat1. My first repeat is bound to this value. In addition while going through the data I create viewScope variable for each Category and store the UNID of each document and they are now in the correct sorted sequence. Now in my control to display this the second nested Repeat is bound to the list of UNIDs for that Category. 

I was wondering how extensible this method might be so I used it against a database with about 16,000 documents and return from the search was about 6000 documents and I was pretty happy with the results. There was a sort pause (maybe a couple seconds) but the result was well worth it. 

Hope this helps. Others may have a better solution and I would love to hear what they have to say.

Jan 30, 2015, 4:03 AM
93 Posts
entriesbykey

Hi Bill,

 

i had started to do something similar, getting allEntriesByKey to then loop through and store an array of the column values I need to sort by. The issue I have is the column value is computed, using @Month, then case to return Jan or Feb etc, + @Year, so the value I need is not actually stored on the document.

As such, I will either have to compute the value when I loop each document, or I may add a field to the documents which computed and stores these value's.... I just need to check with the developer that built it....

 

Thanks again for the pointer and tip

Jan 30, 2015, 6:57 AM
93 Posts
Last step....

Hi Bill,

 

I have built my array succesfully, however the repeat control now repeats the one array value 10 times (which is what I have set as the repeat limit)

Any idea what I am doing wrong and why it is not just repeating once?

 

//Get db and view
var dbEnq:NotesDatabase = session.getDatabase("","protocasebook.nsf");
var vw:NotesView = dbEnq.getView("(EVIndicationsByObligorNo)");

//build doc collection of indications related to this doc
var dc:NotesDocumentCollection = vw.getAllDocumentsByKey(viewScope.obligorNo);
var doc:NotesDocument = dc.getFirstDocument();
var array = new Array;
while (doc != null) {
    //build an array
    array.push(doc.getItemValue("viewFilter"))
    
    var tmpdoc:NotesDocument = dc.getNextDocument();
    doc.recycle();
    doc = tmpdoc;
}

return @Unique(array)

Jan 30, 2015, 11:45 AM
93 Posts
Unique

For the life of me I cant return a unique list from my array......

Jan 30, 2015, 11:47 AM
453 Posts
can you post the source of your page?

When I do this sort of thing I often create an XPage that contains nothing but the repeat and whatever additional information I need to make the repeat work. Then I'm not chasing after unrelated issues. I don't think the issue is with your array. However, I'm wondering if you are trying to do this the hard way. If you are just doing a getAllEntriesByKey why not just let XPages do it for you by using the Filter by Category or the Filter by Column property in the Data Definition and compute the Key Value. I tend to wrap the Repeat Control with a panel and add the Data Definition to the panel so that it is done at the lowest level of the process. Also from a maintenance aspect the relationship between the Data and the Repeat is more obvious.

Jan 30, 2015, 12:27 PM
93 Posts
Messy

Ignore the messy code which needs to be tidied up when everything is working, but this is my custom control with repeat.....

 

Forever getting errors like

 

HTTP JVM: Error with unique array: Error calling method 'infexOf(number)' on an object of type 'Array [JavaScript Object]'

 

 

<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core"
    xmlns:xc="http://www.ibm.com/xsp/custom">
    

    <xp:this.data>
        <xp:dominoView var="view1">
            <xp:this.databaseName><![CDATA[#{javascript:@Name("[CN]",@Subset(@DbName(),1))+"!!protocasebook.nsf"}]]></xp:this.databaseName>
            <xp:this.viewName><![CDATA[#{javascript:"(EVIndicationsByObligorNo)"}]]></xp:this.viewName>
        </xp:dominoView>

    </xp:this.data>
<xp:div styleClass="span-20 last">

    <xp:div styleClass="maincontentdiv">
    
        <xp:repeat id="repeat1" rows="10" var="stateData">
            <xp:this.value><![CDATA[#{javascript:try{

//Get db and view
var dbEnq:NotesDatabase = session.getDatabase("","protocasebook.nsf");
var vw:NotesView = dbEnq.getView("(EVIndicationsByObligorNo)");

//build doc collection of indications related to this doc
var dc:NotesDocumentCollection = vw.getAllDocumentsByKey(viewScope.obligorNo);
print("Obligor No: "+ viewScope.obligorNo);
var doc:NotesDocument = dc.getFirstDocument();
var array = new Array;
while (doc != null) {
    //build an array
    array.push(doc.getItemValue("viewFilter"))
    print("Value: " + doc.getItemValue("viewFilter"));
    var tmpdoc:NotesDocument = dc.getNextDocument();
    doc.recycle();
    doc = tmpdoc;

}

//var text;

for    (i = 0; i < array.length; i++) {
    var a = array.infexOf(i);
        if (a <0){
            print("Less: " + a);
          }else{
              print("More: " + a);
           }
 }   
    
    //text += array[i];
   // print ("T: " + array[i]);
//}

//var ret = [array[0]];
  //  for (var i = 1; i < array.length; i++) { // start loop at 1 as element 0 can never be a duplicate
      //  if (array[i-1] !== array[i]) {
           // ret.push(array[i]);
       // }
    //}
  //  print("RET: " + ret);

 

//var results = @Unique(array);


//print("Results: "+ results);
//print ("Results: " + session.evaluate("@Unique").results(0));
//return session.evaluate("@Unique").results;
//return results;
//print("TYPE: " + typeof results);

//var arArray = new Array;
//arArray.push(results)

//for(var i = 1; i <= @Count(results); i++) {
    //return(@Element(results, i));
//}

   // print("Unique: " + @Unique(temp));
   
   }catch(e){
   print ("Error with unique array: " + (e));
   }}]]></xp:this.value>
            <xp:panel>
                <xp:button value="" id="button2"
                    styleClass="btn btn-success btn-sm">

                    <span class="glyphicon glyphicon-plus"
                        aria-hidden="true">
                    </span>
                    <xp:eventHandler event="onclick" submit="true"
                        refreshMode="partial" refreshId="DetailOuter">
                        <xp:this.action><![CDATA[#{javascript:viewScope.put("showDetail", true)}]]></xp:this.action>
                    </xp:eventHandler>
                </xp:button>
                <xp:button value="" id="button3"
                    styleClass="btn btn-danger btn-sm">

                    <span class="glyphicon glyphicon-minus"
                        aria-hidden="true">
                    </span>
                    <xp:eventHandler event="onclick" submit="true"
                        refreshMode="partial" refreshId="DetailOuter">
                        <xp:this.action><![CDATA[#{javascript:viewScope.put("showDetail", false)}]]></xp:this.action>
                    </xp:eventHandler>
                </xp:button>

                &#160;
                <xp:inputText id="inputText7"
                    styleClass="col-sm-3 control-label"
                    value="#{javascript:stateData}">
                </xp:inputText>

                &#160;


                <xp:panel id="DetailOuter">


                    <xp:table styleClass="table table-bordered">

                        <xp:repeat id="repeat2" rows="100"
                            var="nameData">
                            <xp:this.value><![CDATA[#{javascript:// You could either get the value using getComponent
//view1.getAllEntriesByKey(getComponent("inputText7").getValue());
// Or use the var name of the first repeat
view1.getAllEntriesByKey(viewScope.obligorNo);
}]]></xp:this.value>
                            <xp:this.rendered><![CDATA[#{javascript:viewScope.get("showDetail")}]]></xp:this.rendered>
                            <xp:panel>

                                <xp:tr>
                                    <xp:td>
                                        <xp:inputText id="name">
                                            <xp:this.value><![CDATA[#{javascript:nameData.getColumnValues()[4]}]]></xp:this.value>
                                        </xp:inputText>
                                    </xp:td>
                                    <xp:td>
                                        <xp:inputText id="address">
                                            <xp:this.value><![CDATA[#{javascript:nameData.getColumnValues()[5]}]]></xp:this.value>
                                        </xp:inputText>
                                    </xp:td>
                                    <xp:td>
                                        <xp:inputText id="city">
                                            <xp:this.value><![CDATA[#{javascript:nameData.getColumnValues()[6]}]]></xp:this.value>
                                        </xp:inputText>
                                    </xp:td>
                                    <xp:td>
                                        <xp:inputText id="state">
                                            <xp:this.value><![CDATA[#{javascript:nameData.getColumnValues()[7]}]]></xp:this.value>
                                        </xp:inputText>
                                    </xp:td>
                                    <xp:td>
                                        <xp:inputText id="zip">
                                            <xp:this.value><![CDATA[#{javascript:nameData.getColumnValues()[8]}]]></xp:this.value>
                                            <xp:this.converter>
                                                <xp:convertNumber
                                                    type="number">
                                                </xp:convertNumber>
                                            </xp:this.converter>
                                        </xp:inputText>
                                    </xp:td>
                                </xp:tr>

                            </xp:panel>
                        </xp:repeat>
                    </xp:table>
                </xp:panel>


            </xp:panel>
        </xp:repeat>

    </xp:div></xp:div>    
        
    
</xp:view>

Jan 30, 2015, 5:50 PM
453 Posts
should this not be indexOf

for    (i = 0; i < array.length; i++) {
    var a = array.infexOf(i);
        if (a <0){
            print("Less: " + a);
          }else{
              print("More: " + a);
           }
 }  

 

for    (i = 0; i < array.length; i++) {
    var a = array.indexOf(i);
        if (a <0){
            print("Less: " + a);
          }else{
              print("More: " + a);
           }
 }   

Here is a function I borrowed from some where, I avoid using @Functions as much as possible If you just want unique remove the sort part

 

function sort_unique(arr) {
    // this returns a  sorted list of unique values with no nulls
    arr = arr.sort();
    var ret:Array = new Array;
    //remove all null values
    for (var i = 0; i < arr.length; i++){
        if (!(arr[i] == null || arr[i] == "")){
            ret.push(arr[i]);
        }
    }
    if (ret[0] != null){
        var thisRtn:Array = new Array;
        thisRtn.push(ret[0]);
        for (var i = 1; i < ret.length; i++) { // start loop at 1 as element 0 can never be a duplicate
            if (ret[i-1] !== ret[i]) {
                thisRtn.push(ret[i]);
            }
        }
        return thisRtn;
    } else {
        return "";
    }
    
} //end sort_unique

 

Feb 1, 2015, 8:55 PM
589 Posts
Chris

Is this resolved and working fine for you?

If not please post or email me and I'll look closer in it. I was away last week for ConnectED/Lotusphere and wasn't keeping up with this thread.

 

If it's working great...  if you're trying to do unique things then there is a xsnippet on openntf that's an @DbLookup with a unique and sort function also I believe... That might be worth looking into.

But if it's not working please let me know.

Dave

Feb 2, 2015, 5:59 AM
93 Posts
Half working

Hi both,

 

I have the category return a unique list of values now, however when I expand each category, it shows the same set of documents, so the category is effectively only working as a the title of the twistie.

For example:

 

Document1 has title dogs

Document2 has title cats

 

 

Twistie 1 has title dogs, but shows both documents

Twistie 2 has title cats, but shows both documents

 

 

 

 

 

 

 

 

 

<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core"
    xmlns:xc="http://www.ibm.com/xsp/custom">
    

    <xp:this.data>
        <xp:dominoView var="view1">
            <xp:this.databaseName><![CDATA[#{javascript:@Name("[CN]",@Subset(@DbName(),1))+"!!protocasebook.nsf"}]]></xp:this.databaseName>
            <xp:this.viewName><![CDATA[#{javascript:"(EVIndicationsByObligorNo)"}]]></xp:this.viewName>
        </xp:dominoView>

    </xp:this.data>
<xp:div styleClass="span-20 last">

    <xp:div styleClass="maincontentdiv">
    
        <xp:repeat id="repeat1" rows="10" var="stateData">
            <xp:this.value><![CDATA[#{javascript:var server = "";
var dbname = "protocasebook.nsf";
var cache = "";
var unique = "unique";
var sortit = "";
var viewname = "(EVIndicationsByObligorNo)";
var column = 2;


 
  var cachekey = "dbcolumn_"+dbname+"_"+@ReplaceSubstring(viewname," ","_")+"_"+@ReplaceSubstring(column," ","_");
  // if cache is specified, try to retrieve the cache from the sessionscope
  if (cache.equalsIgnoreCase('cache')) { 
    var result = sessionScope.get(cachekey);
  }
  // if the result is empty, no cache was available or not requested,
  //    do the dbcolumn, convert to array if not, cache it when requested
  if (!result) {
    // determine database to run against
    var db = "";
    if (!dbname.equals("")) { // if a database name is passed, build server, dbname array
      if (server.equals("")){
        db = new Array(@DbName()[0],dbname); // no server specified, use server of current database
      } else {
        db = new Array(server, dbname)
      } 
    }
    var result = @DbColumn(db, viewname, column);
    if (result && unique.equalsIgnoreCase("unique")) result = @Unique(result);
    if (result && typeof result == "string") result = new Array(result);
    if (result && sortit.equalsIgnoreCase("sort")) result.sort();
    if (result && cache.equalsIgnoreCase('cache')) sessionScope.put(cachekey,result);
  } 
  return result;}]]></xp:this.value>
            <xp:panel>
                <xp:button value="" id="button2"
                    styleClass="btn btn-success btn-sm">

                    <span class="glyphicon glyphicon-plus"
                        aria-hidden="true">
                    </span>
                    <xp:eventHandler event="onclick" submit="true"
                        refreshMode="partial" refreshId="DetailOuter">
                        <xp:this.action><![CDATA[#{javascript:viewScope.put("showDetail", true)}]]></xp:this.action>
                    </xp:eventHandler>
                </xp:button>
                <xp:button value="" id="button3"
                    styleClass="btn btn-danger btn-sm">

                    <span class="glyphicon glyphicon-minus"
                        aria-hidden="true">
                    </span>
                    <xp:eventHandler event="onclick" submit="true"
                        refreshMode="partial" refreshId="DetailOuter">
                        <xp:this.action><![CDATA[#{javascript:viewScope.put("showDetail", false)}]]></xp:this.action>
                    </xp:eventHandler>
                </xp:button>

                &#160;
                <xp:inputText id="inputText7"
                    styleClass="col-sm-3 control-label"
                    value="#{javascript:stateData}">
                </xp:inputText>

                &#160;


                <xp:panel id="DetailOuter">


                    <xp:table styleClass="table table-bordered">

                        <xp:repeat id="repeat2" rows="100"
                            var="nameData">
                            <xp:this.value><![CDATA[#{javascript:// You could either get the value using getComponent
//view1.getAllEntriesByKey(getComponent("inputText7").getValue());
// Or use the var name of the first repeat
view1.getAllEntriesByKey(viewScope.obligorNo);

//view1.getAllEntriesByKey(stateData);

}]]></xp:this.value>
                            <xp:this.rendered><![CDATA[#{javascript:viewScope.get("showDetail")}]]></xp:this.rendered>
                            <xp:panel>

                                <xp:tr>
                                    <xp:td>
                                        <xp:inputText id="name">
                                            <xp:this.value><![CDATA[#{javascript:nameData.getColumnValues()[4]}]]></xp:this.value>
                                        </xp:inputText>
                                    </xp:td>
                                    <xp:td>
                                        <xp:inputText id="address">
                                            <xp:this.value><![CDATA[#{javascript:nameData.getColumnValues()[5]}]]></xp:this.value>
                                        </xp:inputText>
                                    </xp:td>
                                    <xp:td>
                                        <xp:inputText id="city">
                                            <xp:this.value><![CDATA[#{javascript:nameData.getColumnValues()[6]}]]></xp:this.value>
                                        </xp:inputText>
                                    </xp:td>
                                    <xp:td>
                                        <xp:inputText id="state">
                                            <xp:this.value><![CDATA[#{javascript:nameData.getColumnValues()[7]}]]></xp:this.value>
                                        </xp:inputText>
                                    </xp:td>
                                    <xp:td>
                                        <xp:inputText id="zip">
                                            <xp:this.value><![CDATA[#{javascript:nameData.getColumnValues()[8]}]]></xp:this.value>
                                            <xp:this.converter>
                                                <xp:convertNumber
                                                    type="number">
                                                </xp:convertNumber>
                                            </xp:this.converter>
                                        </xp:inputText>
                                    </xp:td>
                                </xp:tr>

                            </xp:panel>
                        </xp:repeat>
                    </xp:table>
                </xp:panel>


            </xp:panel>
        </xp:repeat>

    </xp:div></xp:div>    
        
    
</xp:view>

 

 

 

Feb 2, 2015, 11:27 AM
453 Posts
I'm a bit confused

If I understand what you want is a categorized "view" of the data. If that is the case then you need TWO repeat controls. One inside the other. The outside repeat displays the Category and the inside one displays the details for that category. I think you are perhaps making this more difficult than it really needs to be.

I have created "templates" that I use to build categorized "views" (single Category, Two Category and Three Category ) I then make a copy of it and add the variable info to custom properties and into various facets. I can now build a new Categorized repeat in a few minutes rather than starting from scratch. They are too much to post here but would be happy to send them to you (or anyone else that would like them) .

I build a view with the first column categorized and the form

SortOne^CategoryOne~SortTwo^CategoryTwo~sortThree^CategoryThree and another with CategoryOne~CategoryTwo~CategoryThree I only need this one if I want to just use the Category Sequence

This allows me to specify a sort order other than the sort order of the Catgory itself. I have a JS getCategory that will retrieve either Category One Two or Three then the final data is displayed using a a column filter based on the formula Cat1 + "~" + Cat2 + "~" + Cat3

Not sure if this makes things better or worse. 

Feb 2, 2015, 1:19 PM
589 Posts
hmm

Chris,

 

Looking at the code you posted Feb 2....  and I'm really not sure what this view is SUPPOSED to look like...  if you're working with state names..  or animal types and names...  

I'm going to assume animal types at the moment... for the purpose of an example...

I see that you have 2 repeats....  the second repeat... the inner one looks like it's pointing to a viewScope variable...  I don't see that being set anywhere but you don't want that for your inner repeat...  you want to reference the outer repeat...  you've remmed out the more interesting line:

//view1.getAllEntriesByKey(stateData);

in theory that's what you want to use...  assuming view1...  is actually entries by that category....  you only have the one view on the page...  I guess because you're doing the @dbcolumn... but it looks to me like your bound view for the second repeat is the same view as your dbcolumn...  so I'm not sure if that makes sense.  I'd expect maybe 2 different views in play here...

For example... if I'm understanding you correctly...  I'd have the outer view show animal type....  though this could be flat even...

Dogs

    Benji

    Boomer

    Lassie

Cats

    Tom

Rabbits

    Bugs

Etc...

 

Then you could do a DbColumn against that view and make them unique... Now I would NOT use the normal dbcolumn to get that data...  but if you really wanted to use dbcolumn I'd use DbColumnArray as found here:  http://openntf.org/XSnippets.nsf/snippet.xsp?id=dblookup-dbcolumn-with-cache-sort-and-unique  It looks like you did find this....  it would be better to paste that into a script library...  add that as a resource on your page to use it... rather then right in the repeat control...  but in theory you have that working...

When I work with repeats I like to know what's coming back..  in the case of a string like this I'd put the "rowData" in a computed field...  in your case you have that in an inputField... a little odd but should be fine...  Just be sure to check it...

 

So in theory your outer repeat - with the collection name of "stateData" is returning:

Dogs

Cats

Rabbits

Now you want the second repeat to get to the inside...  To make it easier for you for now...  I'd make a second view...  hidden...  but flat...  so no categorized columns...  just sort column0 (Dogs, Cats, etc) and column 1 (Benji, Boomer, etc)...

Then bind the second view to the page...  view2 and do:

view2.getAllEntriesByKey(stateData)

I'm not sure if this is helpful... if not please talk more about your data and your view(s) so we can try and narrow this issue down.

 

Good Luck!

Dave

 

 

Feb 9, 2015, 11:16 AM
93 Posts
filtered

Sorry for the late return to this issue guys!

 

Im still having issues.....

 

I guess the easiest way to describe what I want to do is as follows

 

In the notes client, I have an embedded view on a form which has "Show single category" for "AccountNo"

 

The view then obviously only shows me documents based on the account number from the parent document, and categorize's them by date.

 

It all seems so simple, to replicate as a view/repeat control in xpages, that only shows documents related to an accountNo (bound to a viewScope variable) AND categorized by date created (with twistie)  :-P

 

Im pulling my hair at this a little bit, as I have done many a more complex thing with xpages, and this seems like it should be so simple, but as David mentioned, maybe I am over complicating things and due to my frustrations, not looking at this with a clear mind....

 

So lets say I would like a view that looks like the below, but only shows the documents for Account No: 00001 (And as such, should only show the categories for it aswell, ie dont show December 2012 if no documents exist under that category for this particular account no)

 

January 2014

    Doc 1 

    Doc 2

    Doc 3

December 2013

    Doc 4

November 2013

    Doc 5

Feb 10, 2015, 3:39 PM
453 Posts
Set the Column Filter

in the Data = AccountNo should return the same thing as your single Category View in Notes.

I do this sort of thing all the time.

Feb 10, 2015, 8:34 PM
589 Posts
Chris...

Give me a minute...  I'll have something for you tonight or tomorrow...

Feb 10, 2015, 9:47 PM
589 Posts
ok...

Chris - 

Ok.. so this is all about "Show Single Category in Embedded View" in XPages?  I can handle that.  Actually I did a blog series on that on my old domain lotus notebook.com.  My first blog series and then decided that videos would be easier.  haha

I put together a demo for you...  I'm going to turn it into a NotesIn9 and try and get it out tomorrow....  It didn't take me long to make the demo but it's getting a little late now for me wrap up...  add a few misc things to the beginning and get it out.  So ideally it'll be tomorrow early-ish.

But have you ever seen this show?
http://www.notesin9.com/2010/05/12/notes-in-9-018-xpages-data-relationships/
 

I've not looked at it in a while but that has to include information on the "show single category" thing.  That might be helpful if you can't wait.

 

Feb 11, 2015, 12:15 PM
93 Posts
NoteIn9

Hi David,

 

Thanks that's great! I have yet to see that video, so will look at it tomorrow.

I really love the stuff you and the guys do on NotesIn9 - I literally just finished watching the video on Select2 by John Oldenburger as I could not get the listener to work with a partial refresh..... turns out I had done everything correctly but had neglected to add the select.min.js file as a resource on my page!

I worry about myself sometimes that I go too deep too early rather than starting simple.......

 

I'll watch the video tomorrow, and then follow up with the next video once available.

 

Thanks again guys for your help and support!

Feb 11, 2015, 3:08 PM
589 Posts
Video

Chris - here's the video.  Sorry I didn't get this out earlier today.  

 

http://www.notesin9.com/2015/02/11/notesin9-169-show-single-category-view/

 

It's very basic so I could have missed something but check that out and see if it helps.  Let me know if not.  Email me if needed but I want to make sure any further information gets on this thread.  I wish the forum notified you of followup posts..

Good Luck!

Feb 12, 2015, 5:35 AM
93 Posts
Resolved

David,

 

Thanks I watched both video's.

The single category I was okay with, for some reason however I was struggling to categorize the results.

 

In your video for example:

 

Under DC comics, I then needed documents categorized by comic. So lets say Superman, and Batman, then under these twisties, a list of documents.

 

DC

   - SuperMan

                       Comic 1

                       Comic 2

 +Batman

 

After watching your video, I went back to basics, and played around with the backend view (which I previously was not allowed to do) and now have single category view with categorization levels working!!!!

 

Thanks alot for taking the time to help and post on notesIn9 - It was surreal to see and hear my name on a video series I watch regularly  :- )

 

Thanks for your input aswell Bill,

 

I think I was over complicating everything, and getting myself into a cycle of not thinking clearly, but you have both helped me simplify what I needed so again, many thanks!

 

Feb 12, 2015, 7:56 AM
589 Posts
ahhh

Ok.  I thought I was missing something but wasn't sure what.  I thought there might be a 2 column thing involved which is why I mentioned Vectors though didn't give an example of as I didn't want to confuse anyone.

I'd have to think of my approach but almost certainly for in the document I'd have used nested repeats and avoided viewPanels. The end of this video (https://www.youtube.com/watch?v=uBOt8mMcb10) has an example of nested repeats though in that case i was using a multi-value field and not going back to a view to get more documents.  Nice thing about nested repeats is you can get a lot of control.

Actually when I did the video...  I think that's the first time I've even used a ViewPanel in a LONG time.  haha

 

Anyway...  Glad you got it working and Bill and I were able to provide some help to you.

Dave

P.S. Chris - Feel free to drop me an email and maybe YOU can come on the show and contribute back your final solution. That might help others in the future.  Think about it. :)

Feb 12, 2015, 8:54 AM
93 Posts
NotesIn9

David,

 

That would be great, however due to time constraints I only used a view panel for this, which probably isn't worth the demo, however when I get more time I will possibly use a nested repeat as mentioned so that might be the time to share :-)

In fact  if people were interested I have built a view custom control with multi line content so that when viewed on mobiles the responsive design displays the data perfectly, with search and sort options which is easy to re-use with different views.

 

I've dropped you a mail with my details.

 

Thanks again


FORUM PLAN UPDATE
Date revision: This forum will remain open to new posts and responses until December 1, 2018. (After that date, you will still be able to view and search the forum.) Also, we're taking a second look at the best place to host future conversation. For now, keep using this forum, and stay tuned for more news.