Hans Karlsen (talk | contribs) No edit summary |
No edit summary |
||
Line 16: | Line 16: | ||
|- | |- | ||
|xslt | |xslt | ||
|also see the [[OCLOperators XsltTransformXml|XsltTransformXml]] | |also see the [[OCLOperators XsltTransformXml|XsltTransformXml]] OCL operator | ||
| | | | ||
| | | | ||
Line 40: | Line 40: | ||
savefile | savefile | ||
==== Producing | ==== Producing Export Files From MDriven Server ==== | ||
You can also write files by adding an '''action column''' called “savefile” (case sensitive) | You can also write files by adding an '''action column''' called “savefile” (case sensitive). When the periodic action supervisor in MDrivenServer sees this action column, it looks for two additional columns: path and filename (case insensitive). If these are found, the complete result of the ViewModel is streamed out as XML by using the ViewModelXMLUtils.GetDataAsXml method. The XML is then saved to path/filename. | ||
Like this: | Like this: | ||
Line 47: | Line 47: | ||
[[File:Exporting files from MDriven Server.png|frameless|360x360px]] | [[File:Exporting files from MDriven Server.png|frameless|360x360px]] | ||
In a real world application it | In a real-world application, it looks like this: | ||
[[File:Exporting files from MDriven Server 02.png|frameless|362x362px]] | [[File:Exporting files from MDriven Server 02.png|frameless|362x362px]] | ||
Notice that both path and filename are evaluated expressions, | Notice that both the path and filename are evaluated expressions. Furthermore, the Action UpdateExportTime is executed last – and it changes some data. Since the whole execution is wrapped in a memory transaction, we make sure that we do not update the export time unless the file was written and everything is ok. | ||
The resulting file | The resulting file looks like this: | ||
[[File:Exporting files from MDriven Server 03.png|frameless|409x409px]] | [[File:Exporting files from MDriven Server 03.png|frameless|409x409px]] | ||
==== Shaping and | ==== Shaping and Transforming Export Files ==== | ||
This SaveFile action has been updated to look for a column named | This SaveFile action has been updated to look for a column named XSLT. If it is found, the contents of the field are assumed to be a valid XSLT transformation. The XML from the ViewModel is transformed with the XSLT and the result is saved as above. | ||
So if your | So if your XSLT is… | ||
<?xml version='1.0'?> | <?xml version='1.0'?> | ||
<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform<nowiki/>' | <xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform<nowiki/>' | ||
Line 72: | Line 72: | ||
''NO101087,Cosmica Tygg 90 ST…'' | ''NO101087,Cosmica Tygg 90 ST…'' | ||
==== New Addition 2019 | ==== New Addition March 2019: Arbitrary Filedata ==== | ||
Add a ViewModel column named "filedata". This results in an Image, Blob, or other byte array type, and this data is saved rather than the ViewModel-data-as-XML. | |||
If the "filedata"-column is of type string | If the "filedata"-column is of type string, the string content is written to the file. | ||
See also [[SQLExport from MDriven Server|SQLExport]] | See also: [[SQLExport from MDriven Server|SQLExport]] | ||
[[Category:Advanced]] | [[Category:Advanced]] | ||
[[Category:MDriven Server]] | [[Category:MDriven Server]] |
Revision as of 12:54, 6 February 2023
Special column name | |||
---|---|---|---|
filename | |||
path | |||
xslt | also see the XsltTransformXml OCL operator | ||
filedata | |||
savefile |
filename
path
xslt
filedata
savefile
Producing Export Files From MDriven Server
You can also write files by adding an action column called “savefile” (case sensitive). When the periodic action supervisor in MDrivenServer sees this action column, it looks for two additional columns: path and filename (case insensitive). If these are found, the complete result of the ViewModel is streamed out as XML by using the ViewModelXMLUtils.GetDataAsXml method. The XML is then saved to path/filename.
Like this:
In a real-world application, it looks like this:
Notice that both the path and filename are evaluated expressions. Furthermore, the Action UpdateExportTime is executed last – and it changes some data. Since the whole execution is wrapped in a memory transaction, we make sure that we do not update the export time unless the file was written and everything is ok.
The resulting file looks like this:
Shaping and Transforming Export Files
This SaveFile action has been updated to look for a column named XSLT. If it is found, the contents of the field are assumed to be a valid XSLT transformation. The XML from the ViewModel is transformed with the XSLT and the result is saved as above.
So if your XSLT is…
<?xml version='1.0'?> <xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'> <xsl:output method='text' omit-xml-declaration='yes'/> <xsl:value-of select='ArticleNumber'/>,<xsl:value-of select='SalesArticleName'/> </xsl:template> </xsl:stylesheet>
… then your output would be…
NO101087,Cosmica Tygg 90 ST…
New Addition March 2019: Arbitrary Filedata
Add a ViewModel column named "filedata". This results in an Image, Blob, or other byte array type, and this data is saved rather than the ViewModel-data-as-XML.
If the "filedata"-column is of type string, the string content is written to the file.
See also: SQLExport