Created attachment 204199 [details] Data Provider added Transformation Sort Columns +++ This bug was initially created as a clone of Bug #169596 +++ PRECONDITION: new Calc spreadsheet Data > Define Range = e.g. DataRangeForDataProvider.ods from #169514: https://bugs.documentfoundation.org/attachment.cgi?id=204066 Data > Data Provider select DBrange, CSV, URL 5x3numbersN.csv from #169570 https://bugs.documentfoundation.org/attachment.cgi?id=204142 PROBLEM DESCRIPTION: Data Provider Transformations: Sort Columns [Add] Parameters: Ascending Order, Column in... 9;10 save Calc file --> attached DataProvider-Transformation-SortColumns.ods transformation is not saved in the file this means that Data > Refresh Data Provider does not fill the expected data no data-transformations in content.xml: <calcext:data-mappings> <calcext:data-mapping xlink:href="file:///home/micha/LibreOffice/bugreports/5x3numbersN.csv" calcext:provider="org.libreoffice.calc.csv" calcext:frequency="0" calcext:id="org.libreoffice.calc.csv" calcext:database-name="DBrange"> <calcext:data-transformations/> </calcext:data-mapping> </calcext:data-mappings> EXPECTED BEHAVIOR: transformation Sort Columns shall be saved to content.xml Version: 26.2.0.0.alpha0+ (X86_64) / LibreOffice Community Build ID: 480ef73deef62c458e5735cd496a1d74ef408ed8 CPU threads: 2; OS: Linux 6.8; UI render: default; VCL: gtk3 Locale: de-DE (de_DE.UTF-8); UI: en-US Calc: threaded
I confirm that it is not written to file. Tested with Version: 26.2.0.0.alpha1+ (X86_64) / LibreOffice Community Build ID: f8224b9625c26a7c92a289573765d4a201678d68 CPU threads: 32; OS: Windows 11 X86_64 (build 26100); UI render: Skia/Vulkan; VCL: win Locale: en-US (de_DE); UI: en-US Calc: threaded I wonder what happens here, because ScXMLExport::WriteExternalDataTransformations has a case sc::TransformationType::SORT_TRANSFORMATION
(In reply to Regina Henschel from comment #1) > I wonder what happens here, because > ScXMLExport::WriteExternalDataTransformations has a case > sc::TransformationType::SORT_TRANSFORMATION The implementation has const sc::DocumentLinkManager& rMgr = rDoc.GetDocLinkManager(); const sc::DataStream* pStrm = rMgr.getDataStream(); if (!pStrm) // No data stream. return; pStrm is nullptr here. This part is different from the other cases.
according to Regina's Comment https://bugs.documentfoundation.org/show_bug.cgi?id=169596#c4 the implementation of the export to ODF is NOT missing for SORT_TRANSFORMATION this case has a further impact: all transformations behind the SORT_TRANSFORMATION are not saved as well -->presumably the SORT_TRANSFORMATION aborts all further save processing see below two combined tests: Sort Columns + Delete Column and vv. same PRECONDITION as in bugreport Description A) ordering Sort Columns + Delete Column: Data Provider Transformations: Sort Columns [Add] Parameters: Ascending Order, Column in... 2;3 Data Provider Transformations: Delete Column [Add] Parameters: Cols 7 save Calc file --> attached DataProvider-Transformation-Sort+DeleteCol.ods content.xml: <calcext:data-transformations/> B) reverse order: Delete Column + Sort Columns Data Provider Transformations: Delete Column [Add] Parameters: Cols 7 Data Provider Transformations: Sort Columns [Add] Parameters: Ascending Order, Column in... 2;3 save Calc file --> attached DataProvider-Transformation-Delete+SortCol.ods content.xml: <calcext:data-transformations> <calcext:column-remove-transformation> <calcext:column calcext:column="6"/> </calcext:column-remove-transformation> </calcext:data-transformations> checked as well with further otherwise saved transformations (Aggregate Functions, Numeric, Replace Null, Date and Time) after Sort Column: transformations after the Sort Column transformation are NOT saved.
Created attachment 204223 [details] ordering Sort Columns + Delete Column screen shot
Created attachment 204224 [details] ordering Sort Columns + Delete Column ods
Created attachment 204225 [details] ordering Delete Column + Sort Columns screen shot
Created attachment 204226 [details] ordering Delete Column + Sort Columns ods
one more hint: the processing of save Sort Columns transformation does not inhibit saving of ALL transformations for this file but only the transformations BEHIND the Sort Columns. This can be seen in the example of #169596
I can replace the not working part mentioned in comment 2 with a part that uses the range from aSortParam. That would be ScRange aRange(aSortParam.nCol1, aSortParam.nRow1, aSortParam.nSourceTab, aSortParam.nCol2, aSortParam.nRow2, aSortParam.nSourceTab); Then the transformation is written to file. But that does not really help. The corresponding import is not implemented, see the commented-out part in https://opengrok.libreoffice.org/xref/core/sc/source/filter/xml/xmltransformationi.hxx?r=24552a0b5be620b5e58b10842cba78e36fa26b04#73 The not available sort transformation export stops the further export of transformations because it uses "return" instead of "continue". I do not see this as an error, because the transformations are applied in the given order and if the sort transformation is missing, further transformations would work on a different basis than with sort transformation. Perhaps we should hide the sort transformation in the drop-down list in the dialog until the problems with the sort transformation are solved?