I do not believe it's possible to write via a String Builder DR. What would be its system of record for example? We can check if the SetValue call is supported by looking at the AFDataReference.SupportedMethods property and AFDataReference.SupportedDataMethods property for the String Builder DR (accessed via SupportedMethods property for the String Builder attribute for example).
For String Builder DR, AFDataReference.SupportedMethods does not include SetValue and AFDataReference.SupportedDataMethods does not include UpdateValue.
The String Builder DR is mainly used for metadata or formatting output of another attribute.
For the PREPROCESSHUMIDITY attribute, it seems like it would be a "process data" DR, such as PI Point DR, which would of course accept writes. Is there a specific use case here for writing to the String Builder DR? If it's for formatting, I would recommend writing to a PI Point DR, and then reference the PI Point DR attribute in the String Builder DR attribute to format the output, using a config string such as "Format('PIPointDR1',"%3.2f");%;" for the string builder attribute.
I want to update a numeric value say for example 10 % for that attribute.
later in future i want it to be from PI point tag.
how to set the value using attribute.setvalue?
As Barry Shang mentions above, not sure why you're writing to a String Builder Attribute. You'll be better off in the interim writing to an Attribute configured with no Data Reference if you don't have a PI Point to write to. Also, the Windows Identity you are writing to the Attribute with will need to have the "Write Data" permission on the host Element.
As Rhys mentioned, you can write to an Attribute without a Data Reference, as shown below
In the code, you can do
Because I've configured the UOM above as "percent", there is no need to use String Builder to simply add the UOM (%) (the same applies for PI Point DRs); it will be appended to the number (i.e. 11 %).