Multivalue field + concatenate string in each element

Hello.I have a form with a chekbox mutivalue field. (with 4 constant string options)

In a Xpage i have a checkbox group with this 4 options… the ceckbox group is bind with de form field.

<xp:checkBoxGroup id=“checkBoxGroup1” value=“#{Sorteo.SedeParticipante}” layout=“pageDirection”>

<xp:selectItem itemLabel=“Segui” itemValue=“Segui”>

</xp:selectItem>

<xp:selectItem itemLabel=“Vicente Lopez” itemValue=“Vicente Lopez”>

</xp:selectItem>

<xp:selectItem itemLabel=“Burzaco” itemValue=“Burzaco”>

</xp:selectItem>

<xp:selectItem itemLabel=“Hurlingham” itemValue=“Hurlingham”>

</xp:selectItem>

</xp:checkBoxGroup>

In my Server Side script code I would like to take the field value and convert it to an array and each array element (arry elements is checked items) concatenate a string of 2 letters. (always the same leters)

Have any idea how can I solve this?

I wrotthis code but not working…

var Sedes = dSorteo.getItemValue(“SedeParticipante”);

Sedes.toArray().concat(“$V”),

thanks in advance and sorry for my bad english.

Subject: one solution

You can simply do the following to append the desired valued to each element in the array:

var Sedes = dSorteo.getItemValue(“SedeParticipante”);

Sedes+“$V”;

Subject: Ok, but getalldocuments not working for my.

Hi,Thanks for your answer.

The code…

var Sedes = dSorteo.getItemValue(“SedeParticipante”);

Sedes+“$V”;

Works fine… but… i can’t use getalldocentsbykey !!

var dcEmpleados:NotesDocumentCollection = vEmpleados.getAllDocumentsByKey(Sedes, true);

if “Sedes” contain only one checked item (remember that is associated with the checkbox field) work fine.

but if I select more of one item dont work !!

any idea?

Subject: What is your expectation when passing an array as the key?

Correct me if I’m wrong, but I suspect you are attempting to use an array as a key based on a false understanding of it’s use. If you are expecting each element in the array to be used as a key matching the first column in the view and returning a set of documents which is then combined with the documents returned from each other element in the array to provide a combined document collection then that is an incorrect use of the method.

As per the help documentation, “The first element in the vector is compared to the first sorted column in the view; the second element is compared to the second sorted column; and so on.”, and thus will only return those documents where ALL elements in the array are correctly matched with each corresponding column value.

What I think you really need to do is use a method to loop through each element in the array to get the documents you want and merge them into a single collection. So something like the following (not tested so you may need to correct some of the syntax):

var Sedes = dSorteo.getItemValue(“SedeParticipante”);

Sedes+“$V”;

var allDocs:NotesDocumentCollection = db.getProfileDocCollection(“GiveMeAnEmptyCollection”);

for ( var i=0;i<Sedes.length;i++ ){

 var dcEmpleados:NotesDocumentCollection = vEmpleados.getAllDocumentsByKey(Sedes[i], true);

 allDocs.Merge(dcEmpleados)

}

Subject: You are right

you’re right, I was misunderstanding the function getalldocumentsbykey !

I will test the code !!

THANKS !