This function is assumed to be used together with the download function . Edit the file output by downloading and upload it to perform batch update processing.
In the upload update function, the header (item name) is included in the first linePremise.The header is output by the download function.
If the primary key of the target data is set to use the order, the order is applied by setting the primary key field of the data to "-1".(Automatic numbering process)
To delete data, add the column "<Status>" to the file to be uploaded. In Figure 2, we specify that data with primary key 1007 should be deleted.
In the <Status> column, you can set a character (command) for identifying data to be newly registered, updated, or deleted.
|i||sign up||Register new data.|
|u||update||Update the data.If there is no data corresponding to the primary key, an error occurs.|
|d||Delete||It deletes data.|
|n||None||It does not process anything.|
|Empty string||The same processing as usual||If there is data corresponding to the primary key, update it, otherwise do new registration.|
In the upload update, the input check (including "warning") specified in the repository is applied.
If a data format error (such as mandatory checking, nonnumeric setting where a numeric value should be entered, etc.) is found, the line number of the error data and an error message are displayed on the screen.Data is not updated (registered).Only error-free data is updated (registered).
Read only items are upload updatedExclude from targetIt will be.(It can be changed by setting.)
When a child model is tied to the target model and you want to refer to the value of the child model by an automatic calculation formula or input check,In the upload update, consider "no child model"It will be processed.
This is a measure to affect performance by calling all related child model information from the database every time processing one data.
In the download function setting "Also download the primary key of the model reference itemIf you activate it, you can update it with the primary key of the referenced model.
If both the id column and the item column are set, the item column (content part) takes precedence.When updating with the value of the id column, delete the item column (manually).
Upload update (as well as screen input)filterWill be applied. In the content part character string of the model reference item, the reference itemAheadFilter settings are used.
If the referring destination of the reference linked type item is repeated, and it is a check box, it is not supported.(It will not be updated.)
You can specify the page title and description.(Figure 3)
Figure 4 shows the screen generated by the setting shown in Figure 3.
I will explain the details of upload update setting.
The upload file is defined by the following ruleAutomatic judgmentIt will be.
|csv||Process as CSV (comma separated).|
|tsv||Process it as TSV (tab delimited).|
|Xls or xlsx||Process it as a file in Excel format.|
|Other than those above||It interprets it as the method specified by "upload file type" and processes it.|
That is,When it can not be determined by the extensionIt decides either csv or tsv and interprets it.
There are two ways to lock up upload update.
While this process is executed, all data of the target model will be locked.
This function can be performed at the same time even when there is a user who is updating data.
In either method, browsing systems such as searching, listing and detailed display, and new registration can be done (even during this processing is in progress).
For each model you can specify the character encoding of the upload file.When this value is blank, "Environment> Application> Initial Parameter> Character Encoding of CSV FileThe value of "is used.
For example, if you want to output with UTF-8, write utf-8 in this column.
Model "Save reference linked item to own model"If the settings you are making are included, activate this setting and you can enable the self-model saving function even in upload update.
This function can mix new registration data and update data in the upload file.Therefore, we check the existence of the primary key column.Specifically, it operates as follows.
If you do not update all upload data with new registration data, you can prevent this primary key existence check.
When this setting is valid, "Fixed value - Update userWill be updated (to the user who processed the upload update).Please cancel this setting when you do not update this.
However, if you allow "update read-only items at upload update" and "UPDATE USER" is included in the upload file, update the data in the upload file as "positive" .
When this setting is valid, "Fixed value - Update timeIs updated (at the date and time the upload update was processed).Please cancel this setting when you do not update this.
However, if you allow "update read-only items at upload update" and "update time" is included in the upload file, update the data in the upload file as "positive" .
When this setting is enabled, it will be updated even if either the registration screen or the update screen is read-only.The choices are as follows.
|(Blank)||Follow the setting of the project definition (Standard: "× (not permitted)")|
|×||Do not allow updating|
You can individually specify whether to include each item as uploaded or not.
Controls "to be processed" of "model item detailed definition> input control> upload update".It is blank in the standard.
|Specify processing target||Description|
|(Blank) ※ Standard||Use the value of "Output control - Other - Output to CSV - CSV".[To be described later]|
|○||It becomes the processing target item of upload update.The above "Output to CSV" value is not taken into consideration.|
|×||It is not an item to be processed for upload update.The above "Output to CSV" value is not taken into consideration.|
When the above setting field is "blank", it is controlled by "output to CSV" of "model item detail definition> output control> others".This is enabled by default.
The number of processing corresponds to the number of lines of the read file.This is a number containing header lines and ignored lines.
When updating an Excel file,Rows containing ruled lines are judged as data.If data is not actually included, it is counted as "Ignored Row".That is, lines containing only ruled lines are included in the final processing count.
If an error is included in a specific line, processing is skipped only for that line.Continue processing to the next line.
If a fatal error (file corruption, double quotation is inconsistent) is encountered, processing stops at that point.At this time, it will be updated before the error line.Processing will be skipped after the error line.
By downloading "download all processing result" and "download error processing result" link, you can download each result as a file.
You can download the file by clicking the "Download all processing results" link. The file name is "process_ model name", and its contents are text files.Figure 9 shows an example opened using Excel.
Uploaded dataAbout all casesYou can check the results with the "Success" "Process" "Message" column.They have the following meanings.
|Success||Represents success or failure of processing."Success" in the case of success, "Error" in the case of failure is output.|
|Process||It outputs "Insert" for new registration, "Update" for update, "Delete" for deletion, "None" if nothing is done.|
|Message||Error contents are output.If there are multiple errors, they are output with a line feed.|
The second line (red frame) in Fig. 9 is "information indicating which row was processed"."○" is displayed in the column to be processed.(※note)
You can download the file by clicking the "download error processing result" link. The file name is "error_ model name", and the contents are text files.An example of opening using Excel is shown in Fig. Since there are no errors here, the second and subsequent lines are empty lines.
If there is an error, "Error" is set in the "Success" column.Error contents are output to "Message".
It was not acquired by the download function of Wagby,Use original CSV file for upload updatecan do.Please apply the following rule.
You can compress multiple csv (or tsv) format files into one zip file and upload it.The following rules apply.
It is also possible to mix csv format and tsv format file in zip file.It determines by file extension.
Upload using Excel file When updating, you can specify the numerical format to be used for numerical item analysis. If not specified, the fixed format "
Specify "Model control" input control> upload update> numeric format (Excel) ".In the following example, it is set to enter up to 17 decimal places.
Please confirm the following points.
If only certain columns are not processed correctly, please check whether "Column name" in the first line of the uploaded file and "Column name" in the design information are correctly matched.If the column names do not exactly match, the column will not be processed.
I uploaded the following file for the model using the order as the primary key.The primary key is assumed to be started from 1000 and no data has been registered at the time of processing.
Pkey, name 1000, aaa 1002, bbb 1001, ccc
At this time, the operation will be as follows.
1000, aaa 1001, bbb
1000, aaa 1001, ccc
Countermeasure (1): In order to prevent such malfunctions, it is advisable to set the primary key part to "-1" for registration to the model using order.
Countermeasure (2): The data to be uploaded should be sorted in advance with the primary key.(For example, when acquiring data with the download function, you can avoid it beforehand by specifying rules that use data sorted by primary key.)
For example, although data referring to the "company" model is described as "Yamada Shoten" in the company name, if this data does not exist in the actual company model, this item itself is not updated Hmm.
"Option model"Invalidate choicesSuppose you have invalidated (logical deletion) of certain data in the setting.Here, when updating to invalid data, an update error occurs.
If uploading is done without checking all, it will result in an error.If you check one or more and upload it, it will not result in an error.
If such data exists, it will be ignored or treated as error.For example, suppose you set the following data in the "gender" model.
|3||Man Duplicate content|
At this time, updating the upload from "Woman" to "Men" will result in an error.It is because I can not tell which code 1 or 3 to use.
The following error message is displayed on the screen.
A problem occurred with the value YYY specified for field XXX.Multiple values are defined in the same code.Therefore, we can not identify which code to update.
If the upload target is a "child model", the parent model may also be updated if "screen> others> relevance of model> update parent model when changing" is valid.
In addition, if the parent model has relationships with other models (for example, there are other child models and referring to each other), the relevant models may also be updated as necessary.