auto_stories Bilgi Bankası chevron_right Actions chevron_right Makale

Load CSV Datav5

This action allows data in CSV format Excel files to be transferred to the Grid form component located on the form page.

 

  

Properties

Description:
A description for the action is entered.

Heading:
Specifies the name of the action when it is added as a Form Action.

SQL Query:
When writing a query in this field, the number of columns added to the query must match the number of columns in the .csv file.

Each column must be defined according to its order in the file using the format COL1, COL2, COL3, .... These expressions represent the sequential positions of the columns in the CSV file.

Each column must be given an alias that matches the field names in the Grid component.

Example:

COL1 AS GridField1, 
COL2 AS GridField2, 
COL3 AS GridField3

In the example above, the data in the first column of the .csv file will be transferred to the GridField1 column in the Grid component on the form page.

With this mapping, it is defined which Grid field each column in the CSV file corresponds to.

An important point to consider during mapping is that the data type of the column in the CSV file must be compatible with the data type of the corresponding field in the Grid component.

The table name used in the query must always be written as:

#XPODA_CSV_TABLE

Bracket:
Defines the delimiter character used to separate fields in the uploaded CSV file.

The separator character used in the file must be specified in this field.

The value entered in this field must be:

;

Start Line:
If the CSV file contains a header row with column names, the data reading process must start by skipping this row.

The Start Line property is used to determine this setting.

The Start Line value specifies the row from which the data will be processed, and row numbering starts from 0.

  • If the CSV file contains a header row, the value should be entered as 1 so that the header row is not transferred.
  • If the CSV file does not contain a header row, the value should be entered as 0 so that processing starts from the first row.

This setting ensures that only data rows are processed and correctly transferred to the Grid component on the form.

 

metin, ekran görüntüsü, yazı tipi, sayı, numara içeren bir resim
<p>Yapay zeka tarafından oluşturulmuş içerik yanlış olabilir. 

Line Looking:
The Line Looking option determines whether the rows in the CSV file will be processed individually.

  • When enabled, each row in the list is processed separately.
  • When disabled, the data is processed collectively without row-based separation.

This option is used when row-based controls or operations need to be performed.

Run Condition:
The result of the query entered in the Run Condition field determines whether the action will be executed.

  • If the query result returns '0', the related action will not run.
  • If the result returns a value other than '0' (for example, '1'), the action will run normally.

This feature is used to control the execution of actions under specific conditions and prevents unwanted operations from being performed.

Request Confirmation:
Determines whether user confirmation is required before executing the action.

If Request Confirmation is enabled, the user is asked for confirmation before the action runs.

In this case, the Confirmation Message field becomes available, and the message displayed to the user is entered here.

The Confirmation Message is an informational or warning text displayed before the action is executed. It allows the user to explicitly confirm the operation.


Example Usage 1

A Grid form component and a Button component are added to the form.

The action is added to the button as shown below.

SELECT
COL1 AS Products,
COL2 AS Details,
COL3 AS Amount,
COL4 AS Type,
COL5 AS ProductionDate
FROM #XPODA_CSV_TABLE

The Excel file is prepared without column headers so that the data can be transferred to the Grid form component.

 

Excel View

The prepared Excel file must be saved in CSV format.

The file name should not contain Turkish characters or special characters.

 


When the button is clicked on the Client screen, a file selection window opens.

From this window, the .csv file is selected and the Open button is clicked.

The Excel data is then loaded into the Grid component.

 

 

Client view

Example Usage 2

Load CSV Data can also be used to perform bulk data loading into tables that are not structured as Grid components.

The uploaded CSV file data is transferred to the temporary table created by the system: #XPODA_CSV_TABLE  

The data is then saved into the target table using an: INSERT INTO ... SELECT

The following query can be used to transfer CSV data into the target table:

INSERT INTO [dbo].[SALES_TABLE]
(
    [CreateDate],
    [CreateUser],
    [UpdateDate],
    [UpdateUser],
    [IntegrationID],
    [ProjectID],
    [FormTypeID],
    [LineNumber],
    [RecordGuid],
    [Customer],
    [Vendor],
    [Product],
    [UnitAmount],
    [UnitPrice]
)
SELECT
GETDATE(),
$PActiveUser$,
GETDATE(),
$PActiveUser$,
0,
 2814,
 7090,
 0,
 NEWID(),
COL1,       
COL2,
COL3,     
COL4, 
COL5
FROM #XPODA_CSV_TABLE

Data Loading Steps

  1. Click the Load CSV Data button on the related screen.
  2. Select the CSV file to be uploaded from your computer.
  3. Click the Open button.
  4. The system transfers the CSV file data into the temporary #XPODA_CSV_TABLE table.
  5. The defined INSERT query is executed, and the data is saved into the target table.

To verify that the data has been successfully transferred, the following query can be executed.

Notes

  • The column order in the CSV file must exactly match the COL1, COL2, COL3... fields used in the INSERT query.
  • Data type conversions such as CAST and CONVERT can be used when required.
  • Numeric fields (for example, UnitAmount and UnitPrice) must be provided in a suitable format within the CSV file.
  • As the number of columns increases, additional mappings can be created using COL6, COL7, COL8, and so on.