# Adding attributes to a Compound DS

**URL:** <https://forum.hdfgroup.org/t/adding-attributes-to-a-compound-ds/4320>\
**Category:** HDFView / Java HDF Object Package\
**Created:** [April 25, 2018, 2:04pm UTC](https://forum.hdfgroup.org/t/adding-attributes-to-a-compound-ds/4320 "2018-04-25T14:04:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pattyl](https://forum.hdfgroup.org/letter_avatar_proxy/v4/letter/p/779978/32.png) [@pattyl](https://forum.hdfgroup.org/u/pattyl)\
**Post date:** [April 25, 2018, 2:04pm UTC](https://forum.hdfgroup.org/t/adding-attributes-to-a-compound-ds/4320/1 "2018-04-25T14:04:28Z")

</div>

I’ve added a Compound DS to my .h5 file, and I am adding VLEN\_STRING attributes and values. When I save the file, the values for the strings are lost. For example, I create a Compound DS named “test”. I then right click Properties, click on the Attributes tab, and then Add. I name the property “Foo”, I set the type to VLEN\_STRING, and the value to “Foo who”.  
 ![image](https://hdf-discourse-1.s3.amazonaws.com/original/1X/cc885d62a176b71514fec9a8b1371bc6dd0f85ae.png)

I go to File-\>Save, close the file and then reopen it. I right-click Show Properties on “test”, and my attribute “Foo” is there, but the value is blank.

![image](https://hdf-discourse-1.s3.amazonaws.com/original/1X/d4f327e3b6cd2d492ff8857b1fb7d6a63786b679.png)  
How can I save the string values?

---

<div class="post-metadata">

**Author:** ![bljones](https://forum.hdfgroup.org/letter_avatar_proxy/v4/letter/b/e5b9ba/32.png) [@bljones](https://forum.hdfgroup.org/u/bljones)\
**Post date:** [May 3, 2018, 7:30pm UTC](https://forum.hdfgroup.org/t/adding-attributes-to-a-compound-ds/4320/2 "2018-05-03T19:30:31Z")

</div>

This is a known HDFView bug that we plan to fix.

On the Examples by API page there is an example that shows how to create and write to variable length string attributes (at the very end) in case that helps. See:  
[https://portal.hdfgroup.org/display/HDF5/Examples+by+API](https://portal.hdfgroup.org/display/HDF5/Examples+by+API)
