Method and system for automatically generating dynamic form

Through the method of automatically generating dynamic forms based on Excel files, the problems of high development costs, poor flexibility and high technical threshold in traditional data acquisition methods are solved, efficient, flexible and accurate data acquisition is achieved, and development costs and technical thresholds are reduced.

CN119311690APending Publication Date: 2025-01-14WISDOM QUANCHENG INTELLIGENT TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411345926.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-26
Publication Date
2025-01-14

AI Technical Summary

Technical Problem

Traditional data acquisition methods rely on manual creation of static forms, resulting in high development costs, poor flexibility, low efficiency, high technical thresholds and data consistency problems, making it difficult to adapt to different data acquisition needs.

Method used

The method of automatically generating dynamic forms based on Excel files includes users uploading Excel files, parsing structures, identifying column names and data types, automatically generating form components, user previews and fine-tuning, saving configurations, and dynamically rendering forms on the front-end.

Benefits of technology

It significantly improves efficiency and flexibility, reduces technical thresholds, ensures data consistency, reduces development costs, and improves data acquisition accuracy and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119311690A_ABST
    Figure CN119311690A_ABST
Patent Text Reader

Abstract

The invention provides a method and system for automatically generating a dynamic form, and belongs to the technical field of data acquisition and form generation, and the method comprises the following specific steps: firstly, uploading an Excel file to a system; the system analyzes the structure of the Excel file and identifies a column name and a data type; according to an identification result, the system automatically generates a corresponding form component; the user can preview and finely adjust the generated form; and finally, storing the dynamic form configuration to the background. According to the Excel-based dynamic form generation method, a user can quickly create a complex data acquisition form, and programming skills are not needed. According to the method, high flexibility is provided, and a user is allowed to easily update the form according to the change of the Excel file so as to meet the continuously changing data acquisition requirement.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data collection and form generation, and in particular to a method and system for automatically generating a dynamic form. Background Art

[0002] Data collection is a common and important task in government affairs and data management. Traditional data collection methods usually rely on manually created static forms, which have the following challenges and limitations:

[0003] 1. High development cost: Traditional form design requires developers to manually write HTML and JavaScript code, which is a time-consuming and error-prone process.

[0004] 2. Poor flexibility: Once a form is created, modifying it usually requires recoding, which limits the form's ability to adapt to different data collection needs.

[0005] 3. Inefficiency: When the structure of the data to be collected changes, updating the form often requires a complex development and testing process, resulting in inefficient data collection.

[0006] 4. High technical threshold: It is difficult for non-technical personnel to participate in the design and modification process of the form, which may result in the form not accurately reflecting the actual data collection needs.

[0007] 5. Data consistency issues: Manually created forms may not be consistent with the actual data structure, increasing the workload of data cleaning and organization. Summary of the invention

[0008] In order to solve the above technical problems, the present invention provides a method for automatically generating a dynamic form, which simplifies the data collection process and improves efficiency and flexibility by automatically generating a dynamic form based on an Excel file.

[0009] The technical solution of the present invention is:

[0010] A method for automatically generating a dynamic form comprises the following steps:

[0011] S1. User uploads Excel file;

[0012] S2, parse the structure of the Excel file and identify the column name and data type;

[0013] S3. Automatically generate corresponding form components based on the recognition results;

[0014] S4. The user previews the generated form and can make fine adjustments;

[0015] S5. Save the dynamic form configuration to the background;

[0016] S6. The front end renders the dynamic form according to the configuration.

[0017] Furthermore,

[0018] In step S2, the Excel file is read using a library, the first row is traversed to obtain the column names, and each column of data is analyzed to infer its data type, and the column name and the inferred data type are stored in the memory for subsequent use.

[0019] In step S3, a corresponding form component is created for each column according to the identified column name and data type, including a text input box, a number input box, a date selector, and a drop-down selection box.

[0020] In step S4, the automatically generated form preview is displayed on the user interface, and the user interface is provided to allow the order of form components to be adjusted, component properties to be modified, and component types to be changed.

[0021] In step S5, the form configuration confirmed by the user is converted into JSON format, the configuration includes the type, label, and validation rules of each component, and the JSON configuration is saved in the background database.

[0022] In step S6, the front-end application obtains the saved form configuration from the background; generates a form according to the configuration using dynamic component rendering technology; applies the validation rules and other properties saved in the configuration; provides a data submission function, and sends the filled data back to the server.

[0023] In addition, the present invention also provides a system for automatically generating a dynamic form, comprising:

[0024] File upload module, used to receive Excel files uploaded by users;

[0025] File parsing module, used to parse Excel file structure and identify column names and data types;

[0026] The form generation module is used to automatically generate the corresponding form components according to the parsing results;

[0027] A user interface module that displays a preview form and allows the user to make fine adjustments;

[0028] Configuration storage module, used to save form configuration to the background;

[0029] The form rendering module is used to dynamically render the form based on the configuration on the front end.

[0030] Furthermore,

[0031] The file parsing module uses the library to read the Excel file, traverses the first row to obtain the column name, and analyzes each column of data to infer its data type, and stores the column name and inferred data type in memory for subsequent use.

[0032] The form generation module creates corresponding form components for each column based on the identified column name and data type, including text input box, number input box, date selector and drop-down selection box.

[0033] The user interface module displays the automatically generated form preview on the user interface and provides a user interface to allow the order of form components to be adjusted, component properties to be modified, and component types to be changed.

[0034] The configuration storage module converts the form configuration confirmed by the user into JSON format, includes the type, label, and validation rules of each component in the configuration, and saves the JSON configuration to the background database.

[0035] Form rendering module, the front-end application obtains the saved form configuration from the background; uses dynamic component rendering technology to generate the form according to the configuration; applies the validation rules and other properties saved in the configuration; provides data submission function and sends the filled data back to the server.

[0036] The beneficial effects of the present invention are

[0037] 1. Significantly improve efficiency: By automatically generating forms, the time and workload of manual coding are greatly reduced, and the speed of form development and deployment is accelerated.

[0038] 2. Enhanced flexibility: Users can update the form structure by simply modifying the Excel file without programming knowledge, thereby quickly adapting to changing data collection needs.

[0039] 3. Lower the technical threshold: Non-technical personnel can also participate in the process of form design and modification, which improves the practicality and accuracy of the form.

[0040] 4. Improve data quality: Since the form is generated directly based on the Excel file, it ensures that the form structure is consistent with the expected data structure, reducing data errors and inconsistencies.

[0041] 5. Cost savings: Reduced reliance on professional developers, lowering the overall cost of form development and maintenance.

[0042] 6. Standardization: It promotes the standardization of the data collection process, which is conducive to subsequent data analysis and utilization.

[0043] 7. Rapid iteration: Supports rapid modification and deployment of new versions of forms, which helps to continuously improve the data collection process.

[0044] 8. Improve user experience: Provide end users with a more intuitive and easy-to-use data input interface, improving the efficiency and accuracy of data collection. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] Figure 1 It is a system architecture diagram of the present invention, showing the overall process of Excel file uploading, parsing, form generation and rendering;

[0046] Figure 2 It is a detailed flowchart of Excel file parsing and form component generation, showing the specific steps from reading Excel files to generating corresponding form components;

[0047] Figure 3 It is a user interface diagram, showing the user interface for uploading Excel files, previewing the generated form, and making fine adjustments. DETAILED DESCRIPTION

[0048] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0049] The main purpose of the present invention is to provide a method and system that can automatically generate a dynamic form according to an Excel file, so as to solve the problems existing in the development of traditional forms.

[0050] To achieve the above object, the method for automatically generating a dynamic form based on an Excel file according to the present invention comprises the following steps:

[0051] S1. User uploads Excel file to the system;

[0052] S2. The system parses the structure of the Excel file and identifies the column names and data types;

[0053] S3. Based on the recognition results, the system automatically generates the corresponding form component;

[0054] S4. The user previews the generated form and can make fine adjustments;

[0055] S5. Save the dynamic form configuration to the background;

[0056] S6. The front end renders the dynamic form according to the configuration.

[0057] The method for automatically generating a dynamic form based on an Excel file, wherein the specific scheme of step S2 is:

[0058] 1. Read the Excel file using an appropriate library such as Apache POI for Java or openpyxl for Python.

[0059] 2. Traverse the first row of the Excel file and get the column names.

[0060] 3. Analyze the data in each column and infer its data type (such as text, number, date, etc.).

[0061] 4. Store the column names and inferred data types in memory for later use.

[0062] The method for automatically generating a dynamic form based on an Excel file, wherein the specific scheme of step S3 is:

[0063] 1. Create a corresponding form component for each column based on the column name and data type identified in step S2.

[0064] 2. The text type corresponds to the text input box.

[0065] 3. The number type corresponds to the number input box.

[0066] 4. The date type corresponds to the date selector.

[0067] 5. If it is detected that the column contains a limited number of distinct values, a drop-down selection box is generated.

[0068] 6. Assign a unique identifier to each generated component, corresponding to the Excel column.

[0069] The method for automatically generating a dynamic form based on an Excel file, wherein the specific scheme of step S4 is:

[0070] 1. Display automatically generated form preview on the user interface.

[0071] 2. Provide an interface to allow users to adjust the order of form components.

[0072] 3. Allow users to modify the label, placeholder text and other properties of the form component.

[0073] 4. Provide options for users to change the automatically inferred component type (such as changing a text box to a multi-line text area).

[0074] The method for automatically generating a dynamic form based on an Excel file, wherein the specific scheme of step S5 is:

[0075] 1. Convert the form configuration confirmed by the user into JSON format.

[0076] 2. Include information such as the type, label, validation rules, etc. of each component in the configuration.

[0077] 3. Save the JSON configuration to the backend database.

[0078] The method for automatically generating a dynamic form based on an Excel file, wherein the specific scheme of step S6 is:

[0079] 1. The front-end application obtains the saved form configuration JSON from the backend.

[0080] 2. Use dynamic component rendering technology (such as Vue's dynamic components or React's dynamic imports) to generate the form based on the configuration.

[0081] 3. Apply validation rules and other properties saved in the configuration.

[0082] 4. Provide data submission function to send the filled data back to the server.

[0083] The present invention solves the problems existing in traditional form development, including

[0084] 1. Reduce development costs: By automatically generating forms, the need for manual coding is reduced, reducing development costs and time.

[0085] 2. Improve flexibility: Allow users to update the form structure by simply modifying the Excel file without recoding.

[0086] 3. Improve efficiency: Quickly adapt to changing data collection requirements and reduce the time and resources required to update forms.

[0087] 4. Lower the technical threshold: Allow non-technical personnel to participate in the form design and modification process, and improve the practicality of the form.

[0088] 5. Ensure data consistency: By generating forms directly from Excel files, ensure that the form structure is consistent with the expected data structure.

[0089] 6. Enhance data collection capabilities: Provide more efficient and accurate data collection tools for town-level government affairs and data management.

[0090] The above description is only a preferred embodiment of the present invention, which is only used to illustrate the technical solution of the present invention, and is not used to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.

Claims

1. A method for automatically generating a dynamic form, characterized in that: The following steps are involved: S1. User uploads Excel file; S2, parse the structure of the Excel file and identify the column name and data type; S3. Automatically generate corresponding form components based on the recognition results; S4. The user previews the generated form and can make fine adjustments; S5. Save the dynamic form configuration to the background; S6. The front end renders the dynamic form according to the configuration.

2. The method according to claim 1, characterized in that In step S2, the Excel file is read using a library, the first row is traversed to obtain the column names, and each column of data is analyzed to infer its data type, and the column name and the inferred data type are stored in the memory for subsequent use.

3. The method according to claim 1, characterized in that In step S4, the automatically generated form preview is displayed on the user interface, and the user interface is provided to allow the order of form components to be adjusted, component properties to be modified, and component types to be changed.

4. The method according to claim 1, characterized in that: In step S5, the form configuration confirmed by the user is converted into JSON format, the configuration includes the type, label, and validation rules of each component, and the JSON configuration is saved in the background database.

5. The method according to claim 1, characterized in that In step S6, the front-end application obtains the saved form configuration from the background; generates a form according to the configuration using dynamic component rendering technology; applies the validation rules and other properties saved in the configuration; provides a data submission function, and sends the filled data back to the server.

6. A system for automatically generating dynamic forms, characterized in that: include: File upload module, used to receive Excel files uploaded by users; File parsing module, used to parse Excel file structure and identify column names and data types; The form generation module is used to automatically generate the corresponding form components according to the parsing results; A user interface module that displays a preview form and allows the user to make fine adjustments; Configuration storage module, used to save form configuration to the background; The form rendering module is used to dynamically render the form based on the configuration on the front end.

7. The system according to claim 6, characterized in that The file parsing module uses the library to read the Excel file, traverses the first row to obtain the column name, and analyzes each column of data to infer its data type, and stores the column name and inferred data type in memory for subsequent use.

8. The system according to claim 6, characterized in that The user interface module displays the automatically generated form preview on the user interface and provides a user interface to allow the order of form components to be adjusted, component properties to be modified, and component types to be changed.

9. The system according to claim 6, characterized in that The configuration storage module converts the form configuration confirmed by the user into JSON format, includes the type, label, and validation rules of each component in the configuration, and saves the JSON configuration to the background database.

10. The system according to claim 6, characterized in that Form rendering module, the front-end application obtains the saved form configuration from the background; uses dynamic component rendering technology to generate the form according to the configuration; applies the validation rules and other properties saved in the configuration; provides data submission function and sends the filled data back to the server.