views:

148

answers:

2

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.

+2  A: 

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
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
+1  A: 

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