Exporting data based on the selection in ReflexBlue
ReflexBlue enables you to export only the data you have selected from certain overview screens.
To do this, it is important to first create an export definition from the Import/Export Definitions overview screen. You then need to further modify this export definition so that only the selected data is exported.
Configuring an export definition for selection
The export scripts in the standard export definitions are equipped with functions that export data based on a query that can be customized. To export only the selected data, you use the functions made available for this purpose in ReflexBlue within the export script.
The table below shows some functions that can be used to retrieve data in export scripts. For each entity, there is a function to retrieve data based on a query and a function to retrieve only the selected data.
| Entity | Function for Query-Based Data Retrieval | Function for Selected Data Retrieval | Function for New Data Retrieval |
|---|---|---|---|
| Articles | GetArticlesAsync(query) | GetSelectedArticlesAsync() | |
| Control Points | GetControlPointRegistrationsAsync(query) | GetSelectedPointRegistrationsAsync() | |
| Relations | GetRelationsAsync(query) | GetSelectedRelationsAsync() | |
| Calls | GetCallsAsync(query) | GetSelectedCallsAsync() | |
| Production Charges | GetProductionChargesAsync(query) | GetSelectedProductionChargesAsync() | |
| Purchase Orders | GetPurchaseOrdersAsync(query) | GetSelectedPurchaseOrdersAsync() | GetNewPurchaseOrdersAsync() |
| Sales Orders | GetSalesOrdersAsync(query) | GetSelectedSalesOrdersAsync() | GetNewSalesOrdersAsync() |
| Packing Slips | GetPackingSlipsAsync(query) | GetSelectedPackingSlipsAsync() | GetNewPackingSlipsAsync() |
By replacing these functions in the export script, you can ensure that only the data you have selected is exported.
Example template
Below is an example of an export script for relations that is regularly used in the Export Relations export definition. By changing the function GetRelationsAsync to GetSelectedRelationsAsync, you can modify the script to export relations based on the selection.
@using ReflexNG.ImportsExports.Domain.Templating.Formatters
@using ReflexNG.ImportsExports.Domain.Templating.Relations
@inherits ReflexNG.ImportsExports.Domain.Templating.Relations.RelationsExportTemplate
@{
var csvOptions = CsvOptions.Default.WithSeparator(';');
WriteCsvHeaders(
csvOptions,
"Relatie nummer",
"Relatie naam",
"Korte naam",
//other headers
);
var query = RelationsQuery.Create();
/* Sort options */
query.SortByName();
// Change "GetRelationsAsync(query)" to "GetSelectedRelationsAsync()"
// to export only the selected data
await foreach (var relation in GetRelationsAsync(query))
{
// Samples: How to access dynamic fields
// relation.Dynamic().Common.Common.DYNAMICFILED_ONE
WriteCsv(
csvOptions,
Formatter.Create(relation.Code),
Formatter.Create(relation.Name),
Formatter.Create(relation.ShortName)
//other columns
);
}
} Overview screens for selected data export
Below are the overview screens where exporting data based on the selection is possible:
- Articles overview screen
- Relations overview screen
- Calls overview screen
- Control point registrations overview screen
- Charges overview screen
- Purchase Orders overview screen
- Sales Orders overview screen
- Packing Slips overview screen
Procedure for exporting based on the selected data
To explain the procedure for exporting data based on the selection, we will use the Relations overview screen as an example. Suppose you want to export only certain relations; to do so you can follow the steps below:
-
Select the relations you want to export from the list in the Relations overview screen, possibly after filtering the relations.
-
Select Export Relations to export the selected relations.
-
A list of export definitions will then be displayed. Select an export definition from the list.
If the list of export definitions is empty, you will need to add an export definition for relations via the Import/Export Definitions overview screen.
The selected export definition must already be modified for use in exporting only the selected data, as explained above.
-
The export will start. Once the data has been exported, you will see a notification and can download the export file. Select Download to save the export file.
The other overview screens follow the same principle for exporting data based on the selection. You can perform the same steps there.
Procedure for Exporting New Data
To clarify the process of exporting new data, let’s take packing slips as an example. Do you want to export only the packing slips that you haven’t processed yet? Follow these steps:
-
Create a new packing slips export definition and provide a name and description if necessary.
-
Set the export mode to New Packing Slips. This ensures that only the newest data is included.
-
Do you want to export packing slips for specific relations? Select the desired relation or relation group.
Ensure you use the correct export function
GetNewPackingSlipsAsync(). This function is specifically designed to retrieve new packing slips. -
Save the export definition and click New Import/Export to start the export.
-
The export will start. Once the data has been exported, you will receive a notification, and the export file will be available for download. Select Download to save the export file.
The process for exporting new data follows the same principles for the entities Purchase Orders and Sales Orders.