Cumhur Ata
Cumhur Ata

Reputation: 809

Multivalued Fields in XPages

I have 3 fields with multivalue. I need this field values to be shown line by line in ViewPanel. But I do not know how to do it. For example

FIELD1 Values: Bursa;Adana;Konya (String) FIELD2 Values: 14;15;16 (Numeric) FIELD3 Values: 201,55 ; 155,85 ; 69,96 (Numeric)

What I need to see in a viewPanel that FIELD1 values should be main category then I need see It's value in below. I have created a view but Every value is shown as string seperated vie comma(","). I have no idea how to do it. Please dinf the screenshot below.

VIEW PANEL with Categorized MultiValue Column
->Bursa
14 201,55
->Adana
15 155,85
->Konya
16 69,96

View Screen

Upvotes: 0

Views: 194

Answers (2)

Frantisek Kossuth
Frantisek Kossuth

Reputation: 3524

Repeat will work, as suggested by Stephan. You can make things a bit easier to prepare your data in the view column value:

@Implode( @Text( field ); "<br>")

and make sure the value is treated as HTML by htmlFilter property of the column https://www.ibm.com/support/knowledgecenter/en/SSVRGU_9.0.1/user/wpd_controls_pref_htmlfilter.html.

Upvotes: 0

stwissel
stwissel

Reputation: 20384

Short answer: you don’t use a ViewPanel

Long answer: use a repeat control with the View as data source. Then you have access to each viewEntry and construct multiple HTML lines inside the body of the repeat. You might entertain a second repeat control inside. I would use either a JSON object or an instance of a Java class to rearrange the viewcolumn objects into something easier to iterate.

     function columnsToArray(viewEntry) {
            var result = [];
            // loop through the values
            // to build something like
            // var linearem = {label1: val1, label2: var2}
            result.push(linearem);
            // end loop
            return result;

      }

Pseudo code only

Upvotes: 1

Related Questions