Following process steps are used to export instances from a BO using a query (Person_List_This_Year) and exporting the file using a template format defined in the export template "Attendee_List".
The first 2 steps cause the exported CSV file to be stored in a SystemSetting attribute. The final step displays the CSV file on a form with no buttons to the user can download the CSV file to a destination of their choosing.
Step 3 is used to mop up the files used as temporary storage during the process.
1) EXPORT 'Person_List_This_Year' TO 'c:/AwareIM_temp/RRexpoExport.csv' USING 'Attendee_List'
2) IMPORT DOCUMENT SystemSettings.Export_This_Year_Contacts FROM 'c:/AwareIM_temp/RRexpoExport.csv'
3) DELETE FILE 'c:/AwareIM_temp/RRexpoExport.csv'
4) VIEW SystemSettings USING Show_Export
Using a template with EXPORT action
Using a template with EXPORT action
Tom - V8.8 build 3137 - MySql / PostGres
I did a bit more tweaking to customize the export file name to have 2 components .. text portion stored in a System Settings attribute + a date / time portion. Following are the steps in the revised process:
LoggedInRegularUser.Export_Contacts_File_Name=SystemSettings.Export_Contacts_File_Name+'_'+AS_STRING(CURRENT_DATE)+'_at_'+AS_STRING(CURRENT_HOUR)+'-'+AS_STRING(CURRENT_MINUTE)+'.csv'
EXPORT 'Person_List_This_Year' TO LoggedInRegularUser.Export_Contacts_File_Name USING 'Attendee_List'
IMPORT DOCUMENT SystemSettings.Export_This_Year_Contacts FROM LoggedInRegularUser.Export_Contacts_File_Name
DELETE FILE LoggedInRegularUser.Export_Contacts_File_Name
VIEW SystemSettings USING Show_Export
LoggedInRegularUser.Export_Contacts_File_Name=SystemSettings.Export_Contacts_File_Name+'_'+AS_STRING(CURRENT_DATE)+'_at_'+AS_STRING(CURRENT_HOUR)+'-'+AS_STRING(CURRENT_MINUTE)+'.csv'
EXPORT 'Person_List_This_Year' TO LoggedInRegularUser.Export_Contacts_File_Name USING 'Attendee_List'
IMPORT DOCUMENT SystemSettings.Export_This_Year_Contacts FROM LoggedInRegularUser.Export_Contacts_File_Name
DELETE FILE LoggedInRegularUser.Export_Contacts_File_Name
VIEW SystemSettings USING Show_Export
Tom - V8.8 build 3137 - MySql / PostGres