1

I need to store an array in a custom content type in MOSS. This will always be hidden, only used programmatically. Throughout the lifecycle of the list item, I will be adding values to the array. My array may look like this after a while:

value1,1 | value1,2 | value1,3 | value1,4
value2,1 | value2,2 | value2,3 |
value3,1 | value3,2 | value3,3 |
value4,1 | value4,2 | value4,3 | value4,4

I know I can use SPFieldMultiColumn to store the first row, but it doesn't look like I can store multiple rows. I also know I can just create a text field and serialize my array myself. Just curious if there's already a field to use when you need to store an array.

Nico
  • 13,320
  • 6
  • 32
  • 33
Nathan DeWitt
  • 6,511
  • 8
  • 46
  • 66

2 Answers2

3

There is no out of the box field in which you can store a 2-dimensional array.
Usually, you either store each row in a different item, or you serialize your value in a simpler field (like multiline text).

Nico
  • 13,320
  • 6
  • 32
  • 33
  • As a followup, how do I serialize without first writing a file? See my question here: http://stackoverflow.com/questions/302821/serialization-in-c-without-using-file-system – Nathan DeWitt Nov 19 '08 at 18:11
  • I'm using data classes and JavaScriptSerializer (http://msdn.microsoft.com/en-us/library/system.web.script.serialization.javascriptserializer.aspx) – Nico May 31 '12 at 20:46
1

Serializing it is probably your best solution for small arrays. Or you can store it in a separate list. And remember there's no law against creating your own custom table.

Bjørn Stærk
  • 351
  • 1
  • 4