Closed CooperData closed 2 years ago
checking more on this, it seems that what this might be missing is adding an element to the xml tree similar to this:
<column caption="Search Total Children" datatype="string" name="[SEARCH_TOTAL_CHILDREN]" role="dimension" type="nominal" />
Which is missing from the xml when updating alias and caption. Instead the values that get added are in the metadata-record element:
<metadata-record alias="Search Total Children" caption="Search Total Children" class="column">
<remote-name>SEARCH_TOTAL_CHILDREN</remote-name>
<remote-type>129</remote-type>
<local-name>[SEARCH_TOTAL_CHILDREN]</local-name>
<parent-name>[V_IMPRESSION_ANALYZER_MAIN_MINI]</parent-name>
<remote-alias>SEARCH_TOTAL_CHILDREN</remote-alias>
<ordinal>147</ordinal>
<local-type>string</local-type>
<aggregation>Count</aggregation>
<width>16777216</width>
<contains-null>true</contains-null>
<collation flag="0" name="binary" />
<attributes>
<attribute datatype="string" name="DebugRemoteType">"SQL_VARCHAR"</attribute>
<attribute datatype="string" name="DebugWireType">"SQL_C_CHAR"</attribute>
<attribute datatype="string" name="TypeIsVarchar">"true"</attribute>
</attributes>
</metadata-record>
I'm sure you have long since moved on, but I believe this was actually implemented back in 2016, not sure why it wasn't working for you at the time. When I tried just now, if I add a line to the show_fields sample of field.caption = "NEW LINE", this caption then shows up in the saved file.
My apologies if I am doing something wrong; I am using the development branch and it seems the xml tree is not getting updated after setting some of the properties. The field properties are correctly set but I believe the Datasource.save() method is not really updating the tree with the new properties of the fields.
This what I did:
However, after loading the data source again. The captions were not saved. #103