Export data source as csv
Author: mareike
Publication Date: 4/15/2020 17:38
Hey community,
is it possible to export a data set in FirstSpririt for example as csv file?
Thanks for hints!
Tags: dataset, datasource
-
Author: bojan_vujnovic - 3/25/2021 22:39
Yes it is possible. You must create overview page in Page template(in properties tab, change extension from html to csv)
After that in html tab you create function to access data source. Something like this:
<CMS_FUNCTION name="contentSelect" resultname="fr_content">
<CMS_PARAM name="schema" value="referenceNameSchema" />
<QUERY entityType="referenceNameForTable"/>
</CMS_FUNCTION>$--
--$$CMS_TRIM(level:3)$
$CMS_SET(set_header,["ID","Language","Other fields"])$
$CMS_VALUE(set_header.toString(";"))$
$CMS_FOR(for_item,fr_content)$
$CMS_FOR(sv_lang, #global.project.languages)$
$CMS_SET(#global.language, sv_lang)$
$CMS_SET(set_values,[])$
$CMS_SET(void, set_values.add(if(!for_item.id.isEmpty,for_item.id,"null")))$
$CMS_SET(void, set_values.add(sv_lang))$
$CMS_SET(void,set_values.add(for_item.otherFields)$
$CMS_VALUE(set_values.toString(";"))$
$CMS_END_FOR$
$CMS_END_FOR$
$CMS_END_TRIM$
After this in Page content insert new page(page from page template).Open it and you get csv.
0
Vous devez vous connecter pour laisser un commentaire.
Commentaires
1 commentaire