Skip to Content

displaying the String[] in table

Hi,

I have a function which return String[] and i would like to display the this String Array so which type i should declare for value Attribute.

can any one help me?

Best Regards

Yasir Noman

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Jan 05, 2005 at 11:00 AM

    Hi,

    It depends how you want to represent your String[]

    1. If the String[] is a column then you should bind it to the context node with attribute of type String. You can use .bind(List l) method to make it simpler.

    2. If the String[] is just an element of a table I would suggest to flatten it and then present it as a table element.

    Hope it helps.

    Victor.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Yasir Noman

      Hi Yasir,

      after appending all array elements to the StringBuffer, you get the concatted representation of all strings by the toString() method. Code snippet:

      String[] yourArr = ...;
      StringBuffer sb = new StringBuffer();
      for (int ix = 0; ix < yourArr.length; ix++) {
        sb.append(yourArr[ix]);
      }
      /* Assuming you have a context value attribute of builtin type "string" 
      named "concat" on root level of context */
      wdContext.currentContextElement().setConcat(sb.toString());

      That's all.

      BTW, does it really make sense to display this in a single column? How does the content of the column look like, if you have 30 Strings of 30 characters length or so??

      Hope that helps anyway.

      Regards

      Stefan

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.