A form layout method, apparatus, device, and storage medium
By obtaining form configuration information and answer identifier groups, question instances that match the form data are dynamically generated, solving the problems of complex layout and poor user readability in the form system, and realizing efficient form layout and dynamic question display.
Patent Information
- Application Number
- CN202611288678.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-24
- Publication Date
- 2026-11-17
AI Technical Summary
Existing form systems suffer from problems such as complex form layout, numerous questions, and poor user readability in scenarios like questionnaires and personality tests, and cannot achieve real-time interactive dynamic generation of related questions.
By obtaining the question configuration information of the target form, dynamic question instances are generated based on the answer form data. Using dependencies and answer identifier groups, question instances that match the form data are dynamically generated and rendered and displayed on the page.
It enables real-time interactive dynamic generation of related questions, improves form layout efficiency, simplifies the question display process, and enhances user experience.
Smart Images

Figure CN123115402A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of form technology, and in particular to a form arrangement method, apparatus, device, and storage medium. Background Technology
[0002] In scenarios such as questionnaires and personality tests, the demand for in-depth survey questions is increasing. Existing form systems, when applied to questionnaires and personality tests, require the service provider to create each question individually and define them statically, resulting in complex form layouts, numerous questions displayed to users, and poor user readability. Summary of the Invention
[0003] The main technical problem addressed by this application is to provide a form arrangement method, apparatus, device, and storage medium that enables real-time interactive dynamic generation of related questions, thereby improving form arrangement efficiency.
[0004] To solve the above-mentioned technical problems, the first technical solution adopted in this application is: to provide a form arrangement method, including: obtaining multiple question configuration information in a target form; wherein, when the question type of the question configuration information is dynamic, the question configuration information includes dependencies, the dependencies include dependent question identifiers, and the dependent question identifiers represent the question identifiers of the dependent questions themselves; Based on the form data generated from the target form, obtain the current question's own question identifier and answer identifier group; wherein, the answer identifier group includes a first number of answer identifier values; in response to the target question configuration information being dynamic question configuration information and the dependent question identifier of the dependent item in the target question configuration information matching the current question's own question identifier, generate a first number of dynamic question instances based on the current question's answer identifier group and the target question configuration information; based on the dynamic question instances, render and generate the form question corresponding to the dynamic question instance on the target form's page.
[0005] In one embodiment, the question configuration information includes its own question identifier and its own question tag; based on the answer identifier group of the current question and the target question configuration information, a first number of dynamic question instances are generated, including: for any answer identifier value in the answer identifier group, obtaining the option information corresponding to the answer identifier value, the option information including at least the option identifier value and the option tag value; based on the own question identifier and its own question tag of the target question configuration information, and the option information corresponding to the answer identifier value, constructing a question context for the dynamic question corresponding to the answer identifier value, the question context of the dynamic question including at least: the target question identifier, the target question tag, and dynamic source information; and generating a dynamic question instance corresponding to the answer identifier value based on the question context of the dynamic question and a preset instance template.
[0006] In one embodiment, based on the target question configuration information, the question identifier and question tag of the question itself, and the option information corresponding to the answer identifier value, a question context corresponding to the answer identifier value is constructed, including: generating the target question identifier of the dynamic question based on the question identifier and option identifier value according to the first parsing rule; and generating the target question tag of the dynamic question based on the question tag and option tag value according to the second parsing rule.
[0007] In one embodiment, the question configuration information further includes sub-question configuration information, which includes its own sub-question identifier and its own sub-question tag. After constructing the question context of the dynamic question corresponding to the answer identifier value based on the target question configuration information's own question identifier and its own question tag, as well as the option information corresponding to the answer identifier value, the method further includes: in response to the target question configuration information having sub-question configuration information configured, when generating a dynamic question instance based on the question context and a preset instance template, simultaneously generating the sub-question instance; wherein, generating the sub-question instance includes: constructing the sub-question context based on the sub-question configuration information and the question context; and generating the sub-question instance of the dynamic question instance based on the sub-question context and the instance template.
[0008] In one embodiment, the sub-question configuration information further includes a display / hide trigger set, and the sub-question instance further includes display / hide result information. The display / hide result information of the sub-question instance is determined by the display / hide result information of the dynamic question instance, the answer identifier group of the form question corresponding to the dynamic question instance, and the display / hide trigger set of the sub-question configuration information.
[0009] In one embodiment, the method further includes: in response to the target question configuration information being question configuration information of the static type, constructing a question context corresponding to the static question based on the target question configuration information; wherein the question context includes at least: its own question identifier and its own question tag; generating a static question instance based on the question context of the static question and a preset instance template; and rendering and generating a form question corresponding to the static question instance on the target form page based on the static question instance.
[0010] In one embodiment, a static question instance includes display / hide result information. Generating a static question instance based on the question context of the static question and a preset instance template includes: if the target question configuration information includes question display condition information, obtaining the question identifier of the question display condition item indicated by the question display condition information and the question display condition expression; determining the display / hide result information of the static question instance based on the form data corresponding to the question identifier of the question display condition item and the question display condition expression; the display / hide result information includes a display result and a hidden result; and rendering and generating a form question corresponding to the static question instance on the target form's page based on the static question instance includes: in response to the display / hide result information indicating a display result, rendering and generating a form question corresponding to the static question instance on the target form's page; in response to the display / hide result information indicating a hidden result, skipping the rendering and generating of the form question corresponding to the static question instance on the target form's page based on the static question instance.
[0011] In one embodiment, the question configuration information further includes question display condition information, and the dynamic question instance further includes display / hide result information; in response to the target question configuration information being question configuration information of a dynamic type and the dependent question identifier of the dependent item in the target question configuration information matching the current question's own question identifier, before generating a first number of dynamic question instances based on the current question's answer identifier group and the target question configuration information, the method further includes: if the question configuration information corresponding to the current question includes question display condition information, determining the current question's display / hide result information based on the current question's question display condition information and the current question's answer identifier group; in response to the current question's display / hide result information indicating... If the result is displayed, the process of matching the dependent question identifier of the target question configuration information with the question identifier of the current question is executed. Based on the answer identifier group of the current question and the target question configuration information, a first number of dynamic question instances and subsequent steps are generated. The display result information of the dynamic question instance is determined by the question display condition information and form data in the corresponding question configuration information of the dynamic question instance. If the display result information of the current question indicates that the result is hidden, the process of matching the dependent question identifier of the target question configuration information with the question identifier of the current question is executed. Based on the answer identifier group of the current question and the target question configuration information, the process of generating a first number of dynamic question instances is skipped.
[0012] In one embodiment, the dynamic question instance further includes a rendering type, which is obtained by mapping the question type of the target question configuration information; based on the dynamic question instance, rendering and generating the form question corresponding to the dynamic question instance on the target form page includes: based on the rendering type of the dynamic question instance, finding the corresponding extended information, wherein different rendering types correspond to different extended information; based on the dynamic question instance and the corresponding extended information, rendering and generating the form question corresponding to the dynamic question instance on the target form page.
[0013] In one embodiment, when the question type of the question configuration information corresponding to the current question is a cascading question type, the option identifier value of the question option corresponding to the current question includes the option sub-identifiers corresponding to the second number of levels of sub-questions; based on the form data formed by the answer target form, obtaining the question identifier and answer identifier group of the current question includes: obtaining the option sub-identifiers of each level of sub-questions corresponding to the current question in the form data, and combining the option sub-identifiers of the second number of levels to form the answer identifier value of the current question.
[0014] To address the aforementioned technical problems, the second technical solution adopted in this application comprises: a first acquisition module, a second acquisition module, a generation module, and a rendering module. The first acquisition module acquires multiple question configuration information from the target form. Wherein, if the question type of the question configuration information is dynamic, the question configuration information includes dependencies, each dependency including a dependent question identifier, which represents the self-question identifier of the dependent question. The second acquisition module acquires the self-question identifier and answer identifier group of the current question based on the form data formed by answering the target form. Wherein, the answer identifier group includes a first number of answer identifier values. The generation module, in response to the target question configuration information being dynamic and the dependent question identifier of the dependencies in the target question configuration information matching the self-question identifier of the current question, generates a first number of dynamic question instances based on the answer identifier group of the current question and the target question configuration information. The rendering module renders the form question corresponding to the dynamic question instance on the target form page based on the dynamic question instance.
[0015] To solve the above-mentioned technical problems, the third technical solution adopted in this application is: to provide an electronic device, including: a coupled memory and a processor, wherein the memory stores program instructions, and the processor is used to execute the program instructions to implement the above-mentioned form arrangement method.
[0016] To solve the above-mentioned technical problems, the fourth technical solution adopted in this application is: to provide a computer-readable storage medium for storing program instructions, which can be executed to implement the above-mentioned form arrangement method.
[0017] The beneficial effects of this application are as follows: Unlike the prior art, this application obtains multiple question configuration information from the target form; based on the form data formed by answering the target form, it obtains the question identifier and answer identifier group of the current question; in response to the target question configuration information being dynamic question configuration information and the dependent question identifier of the dependent item in the target question configuration information matching the question identifier of the current question, it generates a first number of dynamic question instances based on the answer identifier group of the current question and the target question configuration information; based on the dynamic question instances, it renders and generates the form questions corresponding to the dynamic question instances on the target form page, and can dynamically generate dynamic question instances corresponding to the answer identifier values in the form data based on the form data formed by answering the current question. The number of dynamic question instances is the same as the number of answer identifier values in the form data, realizing real-time interactive dynamic generation of related questions and improving form arrangement efficiency. Attached Figure Description
[0018] Figure 1 This is a flowchart illustrating one implementation method of the form arrangement method provided in this application; Figure 2 yes Figure 1 The flowchart of step S13 is shown as an embodiment. Figure 3 This is a flowchart illustrating another implementation of the form arrangement method provided in this application; Figure 4 This is a schematic diagram of one embodiment of the form layout device provided in this application; Figure 5 This is a schematic diagram of another embodiment of the form layout device provided in this application; Figure 6 yes Figure 5 Device operation timing diagram; Figure 7 yes Figure 5 A schematic diagram of the rule registrar's workflow in the device; Figure 8 yes Figure 5 Schematic diagram of the working process of the condition evaluator in the device; Figure 9 yes Figure 5 A schematic diagram of the form parser's workflow in the device; Figure 10 yes Figure 5 A schematic diagram of the rendering engine workflow in the device; Figure 11 This is a schematic diagram of one embodiment of the electronic device provided in this application; Figure 12 This is a schematic diagram of one embodiment of the computer storage medium provided in this application. Detailed Implementation
[0019] To make the purpose, technical solution and effects of this application clearer and more explicit, the following describes this application in further detail with reference to the accompanying drawings and embodiments.
[0020] It should be noted that if the embodiments of this application involve descriptions such as "first" or "second," these descriptions are for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, features defined with "first" or "second" may explicitly or implicitly include at least one of those features. Descriptions involving "and / or," such as A and / or B, indicate that A, B, or both A and B are possible. Furthermore, the technical solutions of the various embodiments can be combined with each other, but this must be based on the ability of those skilled in the art to implement them. When the combination of technical solutions is contradictory or impossible to implement, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection claimed in this application.
[0021] See Figure 1 , Figure 1 This is a flowchart illustrating one embodiment of the form arrangement method provided in this application. The form arrangement method provided in this embodiment can be implemented by a computer, server, or other terminal. In some embodiments, the form arrangement method provided in this embodiment can be implemented by running a computer program. The computer program can be a software module in the system, an application program, a mini-program, or a plugin. It should be noted that the forms in this embodiment can be applied to scenarios such as online questionnaires / surveys, personality tests, registration / login, orders / settlement, applications / registration, and risk assessments. It can be understood that the descriptions such as "question" and "sub-question" in this embodiment are used to characterize interactive information with the user, and can be questions, inquiries, prompts, markers, etc. Specifically, this embodiment may include the following steps: Step S11: Obtain the configuration information for multiple questions in the target form.
[0022] In the case where the question type in the question configuration information is dynamic, the question configuration information includes dependencies, and the dependencies include dependent question identifiers, which represent the question identifiers of the dependent questions themselves.
[0023] Each question configuration corresponds to at least one question in the target form. The question configuration information allows the creation of a question instance for rendering the corresponding question, which can be adapted to different front-end frameworks. In other words, based on a single question instance, a specific question can be rendered and generated in the front-end interfaces of different front-end frameworks.
[0024] Specifically, the question configuration information includes the question identifier key, the question label, the question type, and the dependency dynamicSource field, and may also include, but is not limited to, fields such as question options and question display conditions displayCondition.
[0025] The question identifier key is used to uniquely identify the corresponding question configuration information.
[0026] The self-defined title label refers to the title that the user can read after the title is rendered and displayed, corresponding to the specified title configuration information.
[0027] Question types include: static types and dynamic types. Static types include one or more: text input question types, single-choice question types, multiple-choice question types, and cascading question types. Dynamic types include one or more: dynamically repeating single-choice question types and dynamically repeating multiple-choice question types.
[0028] For question configuration information with a dynamic question type, multiple question instances can be dynamically generated, and multiple specific questions can be rendered based on these instances. For example, based on question configuration information for a dynamically repeating single-choice question type, multiple single-choice question instances can be dynamically generated; similarly, based on question configuration information for a dynamically repeating multiple-choice question type, multiple multiple-choice question instances can be dynamically generated. For question configuration information with a static question type, only one question instance can be generated. For example, based on question configuration information for a text input question type, only one text input question instance can be generated; similarly, based on question configuration information for a cascading question type, only one cascading option question instance can be generated; similarly, based on question configuration information for a single-choice question type, only one single-choice question instance can be generated.
[0029] The dependency `dynamicSource` includes, but is not limited to, the dependency key, which indicates the dependencies used in the process of generating a question instance. It is understood that when the question type is static, the dependency is empty; when the question type is dynamic, the dependency is not empty.
[0030] Specifically, when the question type in the question configuration information is dynamic, question instances corresponding to each selected question option can be generated based on the question selected under the question corresponding to the dependent question identifier indicated by the dependency item, combined with the question configuration information.
[0031] For example, the target form can be configured with multiple questions, such as Question A, Question B, and Question C, to survey users' financial investment habits. Wherein: Question A is used to survey the financial service institutions used by users. The options for Question A may include, for example, Bank-Bank A, Bank-Bank B, Brokerage-Brokerage A, Brokerage-Brokerage B, Exchange-Exchange A, Exchange-Exchange B, etc. Specifically, the configuration information for Question A (only a partial configuration is shown) is as follows: {key:"major_competitors", label = "Major competitors / financial service institutions" type:"cascade", dynamicSource:{dependencyKey:""}}; Question B, building upon Question A, is used to survey the services offered by the financial service institutions used by users. For example, options for Question B might include stocks, funds, derivatives, etc. Specifically, the question configuration information for Question B is as follows: {key:"service", label = "Service Content", type:"dynamic_repeater_multiple_choice", dynamicSource:{dependencyKey:"major_competitors"}}, Question C, building upon Question B, is used to survey users' ratings of the services offered by their chosen financial service providers. Question C may include different point values, such as 1, 2, 3, 4, 5, ... and 10 points. Specifically, the question configuration information for Question C is as follows: {key:"score", label = "Service Rating" type:"dynamic_repeater_multiple_choice", dynamicSource:{dependencyKey:"service"}}.
[0032] In the example above, question A has a static type, question B has a dynamic type, question C has a dynamic type, question C depends on question B, and question B depends on question A. It can be understood that `dependencyKey:""` is merely an example indicating that the dependency is empty, and does not limit other possible forms of empty dependencies.
[0033] Based on this, assuming a user selects the options "Bank-Bank A" and "Bank-Bank B" in question A, the question configuration information of question B can dynamically generate question instance B1 (used to survey the services used by the user at Bank A) corresponding to the option "Bank-Bank A" and question instance B2 (used to survey the services used by the user at Bank B) corresponding to the option "Bank-Bank B". It can be understood that question instance B1 and question instance B2 both display all the question options in the question configuration information corresponding to question B, such as stocks, funds, derivatives, etc., for selection.
[0034] Similarly, assuming that for question instance B1 corresponding to "Bank - Bank A", the question options "Stocks" and "Funds" are selected, based on the question configuration information of question C, question instance C1 corresponding to the question option "Stocks" (used to survey users' service rating of Bank A's stock services) and question instance C2 corresponding to the question option "Funds" (used to survey users' service rating of Bank A's fund services) can be dynamically generated. Similarly, for question instance B2 corresponding to "Bank - Bank B", if the question option "Derivatives" is selected, based on the question configuration information of question C, question instance C3 corresponding to the question option "Derivatives" can be dynamically generated (used to survey users' service rating of Bank B's derivatives services). It is understandable that question instances C1, C2, and C3 all display all question options in the question configuration information corresponding to question C, such as all score options from 1 to 10 points, for selection.
[0035] In one implementation scenario, before retrieving multiple question configuration information from the target form, the process also includes retrieving the target form's form configuration information. This form configuration information describes the target form's structure and can specifically be in a declarative JSON data format.
[0036] Specifically, the form configuration information may include question grouping configuration information and question configuration information; wherein, the question grouping configuration information includes: question group identifier and question list corresponding to question group identifier, and the question list includes the question identifier of each question.
[0037] After obtaining the form configuration information, the form configuration information can be traversed to construct question group mapping relationship, question mapping relationship and option mapping relationship. Among them, the question group mapping relationship represents the mapping relationship between question group identifier and question object, the question mapping relationship represents the mapping relationship between the question identifier of each question and the specific question configuration information, and the option mapping relationship represents the mapping relationship between the question identifier of the question, the option identifier value of each question option under the question and the option information. The option information includes, but is not limited to: option identifier value and option label value.
[0038] For example, in the question grouping mapping relationship, the key value is the question group identifier key, and the corresponding value is a list of questions composed of the question identifiers of multiple questions themselves; in the question mapping relationship, the key value is the question identifier of the question itself, and the corresponding value is the question configuration information (including the question identifier key, the question label, the question type type, the dependency dynamicSource, the question options options, the question display condition information displayCondition, etc.); in the option mapping relationship, the key value is the question identifier of the question itself, and the corresponding value is Map<question options options, option information OptionInfo>, that is, a two-level mapping relationship. The option information OptionInfo in the inner mapping relationship includes the option identifier value and the option label value, and other complete information related to the question options.
[0039] Furthermore, when the question configuration information corresponding to the question indicates that the question type is a cascading question type, during the process of constructing the corresponding option mapping relationship, for a question option, the option identifier value recorded in the option information is specifically the option cascading identifier, and the option tag value recorded in the option information is specifically the option cascading path parentValue. Through this option cascading path, the hierarchical structure of the question option can be traced back.
[0040] A cascading question type refers to a question that provides users with cascading sub-options to choose from, forming the final question answer. For example, question D is used to survey users' regions. Question D can be set as a cascading question type, which provides users with three levels of sub-options, such as "province", "city", and "district / town", to choose from to determine the final question answer.
[0041] Specifically, in the process of constructing the corresponding option mapping relationship, the option identifier value for the question option is specifically the option cascading identifier constructed from the option sub-identifiers corresponding to the question sub-options at each level, and the option tag value for the question option is specifically the option cascading path constructed from the option sub-tags corresponding to the question sub-options at each level.
[0042] Taking question D above as an example, assuming the sub-options at each level are "Guangdong Province", "Shenzhen City", and "Futian District", the option cascading identifier constructed based on the option sub-identifiers corresponding to "Guangdong Province", "Shenzhen City", and "Futian District" is "Guangdong Province: Shenzhen City: Futian District". Similarly, assuming the sub-options at each level are "Guangdong Province", "Shenzhen City", and "Nanshan District", the option cascading identifier constructed based on the option sub-identifiers corresponding to "Guangdong Province", "Shenzhen City", and "Nanshan District" is "Guangdong Province: Shenzhen City: Nanshan District".
[0043] It is understandable that when the question type of a question (such as question A) is dynamic, the question corresponding to the dependent question identifier indicated by its dependency (such as question B) is a cascading question type. When generating a question instance corresponding to the selected question option by combining the question configuration information of question A, the option cascading path of the question option can be used to ensure that the complete cascading meaning can be displayed when the question is rendered and displayed later.
[0044] The above mapping relationship can be cached in the cache area. During the dynamic question instance generation process, the corresponding information can be quickly found through the question group mapping relationship, question mapping relationship and option mapping relationship. The time and space complexity of the retrieval is O(1), thereby improving the efficiency of dynamic question instance generation.
[0045] In a specific implementation scenario, a mapping relationship can also be established between a question and other questions that depend on it, based on dependencies. For example, a key-value mapping relationship can be established where question B depends on question A; in this case, question A is the key and question B is the value. This facilitates rapid matching of current question information with target question information.
[0046] Step S12: Based on the form data formed by the target answer form, obtain the question identifier and answer identifier group of the current question.
[0047] The answer identifier group includes a first number of answer identifier values. It is understood that, in response to a trigger operation on any question in the target form, the form data of the target form can be obtained. The trigger operation may include, but is not limited to, operations for selecting question options such as clicking or checking options, and operations for entering text.
[0048] The answer identifier value represents the identifier or key point of the answer to the current question. It can be the option identifier of the target question option selected by the respondent from several question options, or it can be the identifier of the answer text entered by the respondent.
[0049] In one implementation scenario, answer identifier values can be uniformly converted into array format. For example, the answer identifier values corresponding to selected question options and the answer identifier values corresponding to input text can be converted into array format. This allows different types of questions to use a unified form layout, improving layout efficiency.
[0050] For example, the current question is question A "major_competitors", and the question options provided for the current question are ["competitor1", "competitor2", "competitor3"]. The respondent selects the question options ["competitor1", "competitor3"]. The respondent can also enter "competitor4" and "competitor5". At this time, the answer identifier group for question A in the form data can include "competitor1", "competitor3", "competitor4" and "competitor5".
[0051] In one embodiment, when the question type of the question configuration information corresponding to the current question is a cascading question type, the option identifier value of the question option corresponding to the current question includes the option sub-identifiers corresponding to the question sub-options of the second number of levels; based on the form data formed by the answer target form, obtaining the question identifier and answer identifier group of the current question includes: obtaining the option sub-identifiers of the question sub-options of each level corresponding to the current question in the form data, and combining the option sub-identifiers of the second number of levels to form the answer identifier value of the current question.
[0052] The answer identifier group for the current question is formed based on the option identifier values. Option sub-identifiers can be grouped using separators such as "." or "-", and a cascading path can be obtained based on these separators. Alternatively, option sub-identifiers can be grouped using a fixed-length template, and a cascading path can be obtained based on the fixed-length template.
[0053] For example, question E is used to survey users' job-seeking intentions. Question E can be set as a cascading question type, with two levels of sub-options, such as "Industry" sub-options and "Job" sub-options. The first level of "Industry" sub-options can correspond to options such as "Manufacturing," "IT," and "Service Industry." For the "Manufacturing" option, the second level of "Job" sub-options can correspond to options such as "Assembly" and "Machining." For the "IT" option, the second level of "Job" sub-options can correspond to options such as "Development" and "Testing." Suppose a user selects "Manufacturing" and "Assembly" or "IT" and "Testing" in the two levels of sub-options respectively. The two levels of option identifiers can be combined using the "-" symbol to form the option identifier values of question E: "Manufacturing - Assembly" and "IT - Testing." Alternatively, a fixed character length template can be used to combine the sub-identifiers of the two levels of options. For example, the first 4 characters are the sub-identifier corresponding to the first level "industry", and the last 3 characters are the sub-identifier corresponding to the second level "job position". Characters exceeding the length are truncated, and characters insufficient in length are padded with special characters or spaces. This results in the option identifier values "manufacturing assembly position" and "IT industry testing position" for question E.
[0054] Step S13: In response to the target question configuration information being a question configuration information of the dynamic type and the dependent question identifier of the dependent item in the target question configuration information matching the question identifier of the current question, generate a first number of dynamic question instances based on the answer identifier group of the current question and the target question configuration information.
[0055] The target question configuration information can be obtained by searching and matching multiple question configuration information in the target form. Alternatively, it can be obtained by searching based on question mapping relationships established based on dependencies.
[0056] The question instance can be a standardized protocol structure used to provide specific content data when rendering the corresponding form question. It can include dynamic question instances and static question instances. A static question instance refers to a question instance that is fixedly arranged and output based on the question configuration information of the question type being static. A dynamic question instance refers to N question instances that are dynamically generated based on the question configuration information of the question type being dynamic and the selected question options under the question corresponding to the question specified by its dependent question identifier. N is greater than or equal to 1.
[0057] Furthermore, static question instances and dynamic question instances can be based on the same standardized protocol structure, which may include target question identifier, target question tag, rendering type, and display / hidden result information. It may also include option information, dynamic source information, whether the field is dynamically generated, and whether it is a sub-question field.
[0058] The dependency question identifiers of the dependent items in the target question configuration information match the question identifier of the current question itself. This means the current question is the dependent question corresponding to the target question configuration information. Based on the selected question options (i.e., answers) under the current question, and combined with the target question configuration information, question instances corresponding to each selected question option can be generated. Specifically, after obtaining the answer identifier group for the current question, the option information of the corresponding question option can be found based on the answer identifier value in the answer identifier group. Then, based on the option information and the target question configuration information, the first number of dynamic question instances can be generated.
[0059] In one implementation scenario, the question configuration information also includes question display condition information, and the dynamic question instance also includes display / hide result information. If the question configuration information corresponding to the current question includes question display condition information, the display / hide result information of the current question is determined based on the question display condition information and the answer identifier group of the current question; if the display / hide result information of the current question indicates that the result is displayed, step S13 is executed; if the display / hide result information of the current question indicates that the result is hidden, step S13 is skipped.
[0060] The displayCondition information for the question can include the question identifier displayCondition.questionKey, the question display condition expression, and the condition operator and operands.
[0061] When the displayCondition information in the question configuration information corresponding to the current question is not empty, the answer identifier group corresponding to the question identifier indicated by the question identifier in the question display condition item can be obtained from the form data. The answer identifier value in the answer identifier group is substituted into the question display condition expression, and the result of the question display condition expression is used as the display result information for the current question. When the displayCondition information in the question configuration information corresponding to the current question is empty, the display result information for the current question defaults to the displayed result.
[0062] After determining the display and hidden result information of the current question, the display and hidden result information in the dynamic question instance corresponding to the target question configuration information can directly inherit the display and hidden result information of the current question.
[0063] Furthermore, if the current question's display / hidden result information indicates a displayed result, a dynamic question instance can be generated based on the target question configuration information. If the current question's display / hidden result information indicates a hidden result, a dynamic question instance corresponding to the target question configuration information will not be generated.
[0064] Step S14: Based on the dynamic question instance, render and generate the form question corresponding to the dynamic question instance on the target form page.
[0065] After dynamically generating a dynamic question instance, you can call the rendering component based on the dynamic question instance to render the form question corresponding to the dynamic question instance on the target form page.
[0066] In one implementation scenario, a question instance includes a rendering type, which is obtained by mapping the question type of the target question configuration information; step S14 includes: based on the rendering type of the dynamic question instance, finding the corresponding extended information, with different rendering types corresponding to different extended information; based on the dynamic question instance and the corresponding extended information, rendering and generating the form question corresponding to the dynamic question instance on the target form page.
[0067] The rendering types include, but are not limited to, text input question rendering types, single-choice question rendering types, multiple-choice question rendering types, and cascading question rendering types. It is understandable that different rendering types for question instances will correspond to different extended information.
[0068] For example, when the question type in the target question configuration information is a dynamic repeated single-choice question type under the dynamic type, it can be mapped to a single-choice question rendering type. When the question type in the target question configuration information is a dynamic repeated multiple-choice question type under the dynamic type, it can be mapped to a multiple-choice question rendering type, so as to adapt to the extended supported types and avoid the rendering end being aware of the dynamic generation mechanism.
[0069] Similarly, when the question type in the target question configuration information is a static text input question type, it can be mapped to a text input question rendering type. When the question type in the target question configuration information is a static single-choice question type, it can be mapped to a single-choice question rendering type. When the question type in the target question configuration information is a static multiple-choice question type, it can be mapped to a multiple-choice question rendering type. When the question type in the target question configuration information is a static cascade question type, it can be mapped to a cascade question rendering type.
[0070] Extended information refers to the data required to render the question instance as the specific form question on the target form page. This could be a Vue VNode from the Vue front-end framework, or a ReactElement or string template from the React front-end framework. It's understandable that the extended information will differ depending on the front-end framework used by the target form page.
[0071] Specifically, for different front-end frameworks such as Vue 3, React, and Mini Programs, a set of extended information corresponding to different rendering types can be implemented. After obtaining the front-end framework type corresponding to the target form page and the rendering type of the dynamic question instance, the corresponding extended information is determined based on the front-end framework type corresponding to the target form page and the rendering type of the dynamic question instance. Based on the dynamic question instance and the corresponding extended information, the form question corresponding to the dynamic question instance is rendered and generated in the target form page, realizing the same cross-framework adaptation capability without rewriting the orchestration logic for different front-end frameworks.
[0072] The above embodiments involve obtaining multiple question configuration information from the target form; obtaining the question identifier and answer identifier group of the current question based on the form data formed by answering the target form; responding to the target question configuration information being dynamic question configuration information and the dependent question identifier of the dependent item in the target question configuration information matching the question identifier of the current question, generating a first number of dynamic question instances based on the answer identifier group of the current question and the target question configuration information; and rendering and generating the form question corresponding to the dynamic question instance on the target form page based on the dynamic question instance. This allows for the dynamic generation of dynamic question instances corresponding to the answer identifier values in the form data based on the form data formed by answering the current question, with the number of dynamic question instances being the same as the number of answer identifier values in the form data. This achieves real-time interactive dynamic generation of related questions, improving form arrangement efficiency.
[0073] See Figure 2 , Figure 2 yes Figure 1 The flowchart illustrates one implementation of step S13. The question configuration information includes the question's own identifier and its own question tag. Specifically, step S13 includes: Step S21: For any answer identifier value in the answer identifier group, obtain the option information corresponding to the answer identifier value.
[0074] The option information includes at least option identifier values and option label values. Specifically, the answer identifier values in the answer identifier group can be obtained through methods such as sequential selection and synchronous execution.
[0075] After obtaining the answer identifier value, you can search for option information whose option identifier value matches the answer identifier value from the question options in the question configuration information of the current question.
[0076] Furthermore, as mentioned above, for the target form, question mapping relationships and option mapping relationships can be pre-constructed. After determining the answer identifier value, the question mapping relationship and option mapping relationship can be referenced to obtain the option information corresponding to the option identifier value that matches the answer identifier value. The option mapping relationship represents the mapping relationship between its own question identifier, option identifier value, and option information.
[0077] In one embodiment, when the question type in the question configuration information corresponding to the current question is a cascading question type, the option tag value in the option information corresponding to the answer identifier value is specifically the option cascading path constructed by the option tags of the options corresponding to each sub-question under the current question.
[0078] Step S22: Based on the target question configuration information, its own question identifier and its own question tag, and the option information corresponding to the answer identifier value, construct the question context of the dynamic question corresponding to the answer identifier value.
[0079] The question context gathers various real-time information and question configuration information required for the generation of dynamic question instances. Specifically, the question context of a dynamic question includes at least: target question identifier, target question tag, and dynamic source information. The target question identifier is used to uniquely identify the dynamic question (or the question instance of the dynamic question), and the target question tag is used to render the user-readable title of the corresponding question after the dynamic question (or the question instance of the dynamic question) is rendered and displayed.
[0080] It is understandable that when the question configuration information indicates that the question type is dynamic, i.e., in the case of dynamic questions, the question configuration information can be understood as the declaration of the question template for dynamic questions. The question identifier in the question configuration information is the template for the question identifier of the dynamically generated dynamic questions (or dynamic question instances) in the future. It needs to generate the corresponding question identifier in real time based on the selected option information in its dependent questions. Similarly, the question tag in the question configuration information is the template for the question tag of the dynamically generated dynamic questions (or dynamic question instances) in the future. It needs to generate the corresponding question tag in real time based on the selected option information in its dependent questions.
[0081] In one implementation scenario, step S22 includes: generating a target question identifier for the dynamic question based on its own question identifier and option identifier values according to the first parsing rule; and generating a target question label for the dynamic question based on its own question label and option label values according to the second parsing rule.
[0082] In a specific implementation scenario, the combination of the question identifier and the option identifier values can be used to form the target question identifier for a dynamic question. For example, the combination of the question identifier and the option identifier values can be represented as an array, or it can be represented by connecting symbols (such as "-", ".", etc.). The first parsing rule is used to identify the question identifier part and the option identifier value part.
[0083] In a specific implementation scenario, the question identifier of the question configuration information includes a first part identifier and a second part identifier. The first part identifier and the second part identifier are combined with reference to the first template syntax. The first part identifier is used to represent the identifier configuration parameter, and the second part identifier is used to represent the query identifier of the corresponding question.
[0084] The question configuration information includes a first part tag and a second part tag. The first part tag and the second part tag are combined with reference to the second template syntax. The first part tag is used to represent the tag configuration parameters, and the second part tag is used to represent the query tag of the corresponding question.
[0085] The first parsing rule corresponds to the first template syntax. The second parsing rule corresponds to the second template syntax. The query identifier or query tag represents the intent, query point, or key point of the question generated based on the question configuration information.
[0086] Based on the first parsing rule, the first part of the identifier of the question itself in the target question configuration information is identified, namely the identifier configuration parameter. The identifier configuration parameter is updated to the option identifier value in the option information. In other words, the first part of the identifier is updated to the option identifier value in the option information, thus forming the target question identifier of the dynamic question.
[0087] Based on the second parsing rule, the first part of the tag in the target question configuration information, namely the tag configuration parameter, is identified. The tag configuration parameter is then updated to the option tag value in the option information. In other words, the first part of the tag is updated to the option tag value in the option information, thus forming the target question tag of the dynamic question.
[0088] The dynamic source information includes: identifier configuration parameters, tag configuration parameters, and dependent question identifiers, which are used to identify the dependent questions of the generated dynamic questions.
[0089] For example, the answer identifier group [competitor1, competitor2] and the corresponding answer tag group [competitor1, competitor2] are obtained from the form data generated by answering the current question (e.g., marked as question A); The title identifier of the target title (e.g., title B) in the title configuration information is "${sourceValue}_service". Here, "sourceValue" is the first part of the identifier, which represents the identifier configuration parameter of title B corresponding to its own title identifier. "service" is the second part of the identifier, which represents the query identifier of title B. The first part of the identifier "sourceValue" and the second part of the identifier "service" are combined through the first template syntax to obtain the title identifier of title B. Here, ${varName1} is the first template syntax, and varName1 represents the parameter in the first template syntax.
[0090] The title tag for title B in the title configuration information is: "Services for {{sourceLabel}}". Here, "sourceLabel" is the first part of the tag, which represents the tag configuration parameter of title B's title tag. "Services for..." is the second part of the tag, which represents the query tag of title B. The title tag for title B is obtained by combining the first part of the tag "sourceLabel" and the second part of the tag "Services for..." through the second template syntax. Here, {{varName2}} is the second template syntax, and varName2 represents the parameter in the second template syntax.
[0091] Based on the first parsing rule, the identifier configuration parameter in the question identifier is identified as sourceValue, and sourceValue is updated to the answer identifier value "competitor1". The target question identifier of the context of question B is "competitor1_service".
[0092] Based on the second parsing rule, the label configuration parameter in the question identifier is identified as sourceLabel, and sourceLabel is updated to the answer label value "competitor 1". The target question label in the context of question B is "service for competitor 1".
[0093] In this embodiment, the parsing processes for question identifiers and question tags are completed in parallel within the same parsing call, without interference between them. This achieves semantic separation between question identifiers and question tags, avoiding the semantic confusion caused by a single grammatical character serving as both an identifier and a tag. Furthermore, based on its own question identifier and option identifier values, the system generates a target question identifier for dynamic questions, and based on its own question tag and option tag values, it generates target question tags for dynamic questions. This ensures that the target question identifier and target question tag for dynamic questions are unique, guaranteeing that the system will not encounter ambiguity or confusion in question recognition and improving system stability.
[0094] Step S23: Based on the question context of the dynamic question and the preset instance template, generate a dynamic question instance corresponding to the answer identifier value.
[0095] The preset instance template includes the target question identifier, target question tag, rendering type, and display / hidden result information. It may also include dynamic source information, option type, whether it is dynamically generated, and whether it is a sub-question. After obtaining the question context of the dynamic question, the question context of the dynamic question can be filled into the preset instance template to generate the corresponding dynamic question instance.
[0096] Through the above embodiments, dynamic question instances that correspond one-to-one with each answer identifier value in the answer identifier group can be generated, and corresponding form questions can be generated in the target form based on the dynamic question instances.
[0097] In one implementation scenario, sub-topic configuration information can be configured in the target topic configuration information. In response to the sub-topic configuration information being configured in the target topic configuration information, when generating a dynamic topic instance based on the topic context and a preset instance template, a sub-topic instance is generated simultaneously. The generation of a sub-topic instance includes: constructing a sub-topic context based on the sub-topic configuration information and the topic context; and generating a sub-topic instance of the dynamic topic instance based on the sub-topic context and the instance template. The topic configuration information also includes sub-topic configuration information, which includes its own sub-topic identifier and its own sub-topic tag.
[0098] This includes the ability to include sub-question configuration information within the question configuration information. For example, in a scenario where a question offers multiple options and an "other" option, and a sub-question is added under that question to collect the user's input when the user selects the "other" option, the sub-question configuration information can be included in the question configuration information.
[0099] The sub-topic configuration information may include fields such as its own topic identifier (key), its own topic label (label), trigger values (triggerValues), and other additional information (config). The sub-topic identifier is used to uniquely identify the sub-topic configuration information, and the sub-topic label indicates the title that the user can read after the corresponding sub-topic is rendered and displayed.
[0100] The sub-topic context includes at least: the target topic identifier and the target topic tag. The target topic identifier is used to uniquely identify the sub-topic (or the sub-topic instance of the sub-topic), and the target topic tag is used to render the title that the user can read after the sub-topic (or the sub-topic instance of the sub-topic) is rendered and displayed.
[0101] Specifically, the target question identifier in the sub-question context can be obtained based on the target question identifier in the parsed question context corresponding to the parent question and the question identifier in the sub-question configuration information. Similarly, the target question tag in the sub-question context can be obtained based on the target question tag in the parsed question context corresponding to the parent question and the question tag in the sub-question configuration information.
[0102] Furthermore, the parent question can refer to either a dynamic question or a static question.
[0103] It is understandable that the sub-topic identifier and sub-topic tag in the sub-topic configuration information have the same data structure as the sub-topic identifier and sub-topic tag in the aforementioned topic configuration information. During the generation of sub-topic instances, based on the first parsing rule, the first part of the sub-topic identifier in the sub-topic configuration information, i.e., the identifier configuration parameter, can be identified. This identifier configuration parameter is then updated to the target topic identifier of the parsed topic context corresponding to the parent topic. In other words, the first part of the identifier is updated to the target topic identifier of the parsed topic context corresponding to the parent topic, thus forming the target topic identifier of the sub-topic.
[0104] At the same time, based on the second parsing rule, the first part of the tag of the sub-question's own question tag in the sub-question configuration information, namely the tag configuration parameter, is identified. The tag configuration parameter is then updated to the target question tag of the question context that has been interpreted and obtained corresponding to the parent question. In other words, the first part of the tag is updated to the target question tag of the question context that has been interpreted and obtained corresponding to the parent question, thus forming the target question tag of the dynamic question.
[0105] The question instance may also include sub-question instances. A sub-question instance refers to a question instance arranged and output based on the sub-question configuration information contained under the question configuration information corresponding to the parent question. The parent question can be a static question or a dynamic question. Furthermore, the sub-question instance and the static question instance and / or dynamic question instance can be the same standardized protocol structure, which may include target question identifier, target question tag, rendering type, display / hidden result information, and may also include option information, dynamic source information, whether it is dynamically generated identifier, whether it is a sub-question field, etc.
[0106] In a specific implementation scenario, the sub-question configuration information also includes a set of display / hide triggers, and the sub-question instance also includes display / hide result information. The display / hide result information of the sub-question instance is determined by the display / hide result information of the dynamic question instance, the answer identifier group of the form question corresponding to the dynamic question instance, and the set of display / hide triggers of the sub-question configuration information.
[0107] The display / hidden result information includes both displayed and hidden results. The logic for determining the display / hidden results of sub-question instances can be preset, and this logic is used to determine the display / hidden result information of the sub-question instances. For example: using the conditional logic `parent.visible && parentValues ∩ triggerValues ≠` ; Here, `parent.visible` represents the visibility information of the dynamic question instance, `parentValues` represents the answer identifier group corresponding to the dynamic question instance, `triggerValues` represents the set of visibility triggers, which can include this set, `&&` is the logical AND operation, and `∩` is the intersection operation. If the parent.visible result information of the dynamic question instance is the display result, and at least one of the parentValues and triggerValues sets of the answer identifiers of the dynamic question instance is the same, then the display result information of the child question instance represents the display result.
[0108] The above embodiments utilize sub-question configuration information to expand the questions, supporting additional input scenarios such as "others," thereby broadening the application scenarios of the form and improving form layout efficiency. The display / hiddenness of the questions is determined during the form layout stage. When outputting to the rendering layer, only the display / hiddenness result needs to be read to decide whether to render, achieving complete separation between the display / hiddenness logic and the rendering logic. Preset instance templates define a standardized layout output protocol, adaptable to different rendering mechanisms.
[0109] See Figure 3 , Figure 3 This is a flowchart illustrating another implementation of the form arrangement method provided in this application. Specifically, it includes: Step S31: Obtain the configuration information for multiple questions in the target form.
[0110] Step S32: In response to the target question configuration information being of the static type, construct the question context corresponding to the static question based on the target question configuration information. The question context includes at least: its own question identifier and its own question tag.
[0111] Step S33: Generate a static question instance based on the question context of the static question and the preset instance template.
[0112] It is understandable that when the question configuration information indicates that the question type is static, that is, in the case of static questions, the question configuration information can be understood as a fixed declaration of static questions. The question identifier in the question configuration information is the target question identifier of the static question (or static question instance), and the question tag in the question configuration information is the target question tag of the static question (or static question instance). The question configuration information can be directly used as the question context to generate static question instances.
[0113] In one implementation scenario, a static question instance includes display / hide result information. Step S33 includes: if the target question configuration information includes question display condition information, obtaining the question identifier of the question display condition item indicated by the question display condition information and the question display condition expression; determining the display / hide result information of the static question instance based on the form data corresponding to the question identifier of the question display condition item and the question display condition expression; the display / hide result information includes the displayed result and the hidden result.
[0114] If the target question configuration information does not include question display condition information, the display / hidden result information in the static question instance can be directly determined as the display result, and the form question corresponding to the static question instance can be rendered and generated on the target form page.
[0115] The `displayCondition` parameter can include the question identifier `displayCondition.questionKey`, the question display condition expression, and the conditional expression itself, which includes the conditional operator and operands `values`. Answer identifier groups for questions whose question identifier matches `displayCondition.questionKey` can be retrieved from the form data. The answer identifier values from these groups are then substituted into the question display condition expression, and the result of this expression is used as the display / hidden result information for the static question instance.
[0116] Step S34: Based on the static question instance, render and generate the form question corresponding to the static question instance on the target form page.
[0117] In one implementation scenario, the static question instance includes display / hide result information. Step S34 includes: in response to the display / hide result information indicating that the result is to be displayed, rendering and generating the form question corresponding to the static question instance on the target form's page; in response to the display / hide result information indicating that the result is to be hidden, skipping the rendering and generation of the form question corresponding to the static question instance on the target form's page based on the static question instance.
[0118] The above form arrangement method will be further explained below with reference to a specific embodiment: S1: Retrieve the form configuration information of the target form.
[0119] The form configuration information describes the structure of the target form, specifically in a declarative JSON data format. The form configuration information includes question grouping configuration information and question configuration information. The question grouping configuration information includes a question group identifier and a list of questions corresponding to that identifier. The question list includes the question identifiers for each question. The question configuration information includes fields such as the question identifier key, question label, question type, dependency dynamicSource, question options, question display conditions displayCondition, and sub-question configuration information.
[0120] After obtaining the form configuration information, iterate through the form configuration information to construct the question grouping mapping relationship, question mapping relationship, and option mapping relationship.
[0121] S2: For questions of static type, generate the static question instance based on the question configuration information.
[0122] After obtaining the question grouping mapping relationship, question mapping relationship, and option mapping relationship, the target form can be arranged. Specifically, the question configuration information of all questions in the question mapping relationship can be traversed, and the questions can be divided into two paths for processing based on their type: "static questions" and "dynamic repeaters". For question configuration information of static type, that is, for static questions, as mentioned above, when the question configuration information indicates that the question type is static, the question configuration information can be understood as a fixed declaration of static questions. The question identifier in the question configuration information is the target question identifier of the static question (or static question instance), and the question tag in the question configuration information is the target question tag of the static question (or static question instance). The question configuration information can be directly used as the question context to generate static question instances.
[0123] Specifically, in response to the target question configuration information being static, a question context corresponding to the static question is constructed based on the target question configuration information; wherein, the question context includes at least: a target question identifier and a target question tag; and a static question instance is generated based on the question context of the static question and a preset instance template.
[0124] S3: For question configuration information of dynamic type, determine the dependent question identifier of the dependent item in the question configuration information, obtain the answer identifier group of the question corresponding to the dependent question identifier from the form data, and generate the first number of dynamic question instances based on the answer identifier group of the question corresponding to the dependent question identifier and the question configuration information of dynamic type.
[0125] For question configuration information of dynamic type, i.e. dynamic repeater, the dependent question identifier of the dependent item in the question configuration information can be determined, and the question configuration information of the dependent question corresponding to the dependent question identifier can be obtained from the question mapping relationship; at the same time, the answer identifier group corresponding to the dependent question can be extracted from the form data.
[0126] The form data is obtained based on real-time monitoring of form data changes and user actions. For example, during continuous user operations, the form data changes rapidly; the form data is retrieved after the user stops operating for a preset period (for anti-jitter). The form data includes a question identifier and a set of answer identifiers corresponding to the question identifiers. The answer identifier set includes a first number of answer identifier values.
[0127] For any answer identifier value in the answer identifier group, refer to the question mapping relationship and the option mapping relationship to obtain the option information corresponding to the option identifier value that matches the answer identifier value. Among them, when the question type that depends on the question configuration information corresponding to the question identifier is a cascading question type, the option tag value in the option information corresponding to the answer identifier value is specifically the option cascading path constructed by the option tags of the options corresponding to the options of each sub-question under the question corresponding to the question identifier.
[0128] Based on the question's own question identifier and its own question tag (for questions of the dynamic type), and the option information corresponding to the answer identifier value of the question corresponding to the dependent question identifier, a question context is constructed for the dynamic question corresponding to the answer identifier value of the question corresponding to the dependent question identifier. The question context for the dynamic question includes: the target question identifier, the target question tag, and dynamic source information. The dynamic source information includes: identifier configuration parameters, tag configuration parameters, and dependent question identifiers.
[0129] The process of constructing the target question identifier may include: based on the first parsing rule, identifying the first part of the question identifier in the question configuration information of the question type dynamic, namely the identifier configuration parameter, and updating the identifier configuration parameter to the option identifier value in the option information. In other words, updating the first part of the identifier to the option identifier value in the option information forms the target question identifier for the dynamic question.
[0130] The process of constructing target question tags may include: based on the second parsing rule, identifying the first part of the tag in the question configuration information of the question type dynamic, namely the tag configuration parameter, updating the tag configuration parameter to the option tag value in the option information, that is, updating the first part of the tag to the option tag value in the option information, thus forming the target question tag for the dynamic question.
[0131] After obtaining the question context of the dynamic question, a dynamic question instance corresponding to the answer identifier value can be generated based on the question context of the dynamic question and the preset instance template.
[0132] For any question type's question configuration information, if the question configuration information includes sub-question configuration information, after obtaining the question instance corresponding to the question configuration information, a corresponding sub-question instance can be generated based on the sub-question configuration information. Specifically, a sub-question context is constructed based on the sub-question configuration information and the question context of the question instance corresponding to the question configuration information; a sub-question instance corresponding to the sub-question configuration information is generated based on the sub-question context and a preset instance template. The sub-question's question context includes: sub-question identifier and sub-question tag.
[0133] Furthermore, based on the target question identifier in the question context of the question instance corresponding to the question configuration information and the question identifier of the sub-question configuration information, the target question identifier in the sub-question context can be obtained. Based on the target question tag in the question context of the question instance corresponding to the question configuration information and the question tag of the sub-question configuration information, the target question tag in the sub-question context can be obtained.
[0134] Furthermore, during the process of obtaining static question instances, dynamic question instances, and sub-question instances under static question instances and / or dynamic question instances, the display / hiding of question instances can also be evaluated. Specifically, for static question instances, the display / hiding result information of the corresponding static question instance can be determined by the judgment logic indicated by the question display condition information preset in the question configuration information; for dynamic question instances, the display / hiding result information of the corresponding dynamic question instance can be determined based on the display / hiding result information of the question instance corresponding to its dependent question and the answer identifier group of the dependent question in the form data; for sub-question instances, the display / hiding result information of its parent question instance, the answer identifier group of the parent question in the form data, and the display / hiding trigger set of the sub-question configuration information can be determined, as detailed in the above embodiments.
[0135] S4: Based on the static question instance and the dynamic question instance, render and generate the form questions corresponding to the static question instance and the dynamic question instance on the target form page.
[0136] After obtaining static question instances, dynamic question instances, and sub-question instances under static question instances and / or dynamic question instances, a set of question instances corresponding to the target form can be arranged based on the static question instances, dynamic question instances, and sub-question instances under static question instances and / or dynamic question instances. Then, for any question instance in the set of question instances, the display result information of the question instance can be obtained. If the display result information of the question instance is a display result, the form question of the question instance can be rendered on the page of the target form. If the display result information of the question instance is a hidden result, the form question of the question instance is not rendered on the page of the target form.
[0137] Specifically, based on the rendering type of static and dynamic question instances, the corresponding extended information is retrieved, with different rendering types corresponding to different extended information; based on the static question instance and its corresponding extended information, the form question corresponding to the static question instance is rendered and generated on the target form page, and based on the dynamic question instance and its corresponding extended information, the form question corresponding to the dynamic question instance is rendered and generated on the target form page.
[0138] In response to the generation of static and / or dynamic question instances, corresponding sub-question instances are generated simultaneously. Based on the rendering type of the sub-question instance, the corresponding extended information is searched. Based on the sub-question instance and the corresponding extended information, the form question corresponding to the sub-instance is rendered and generated on the target form page.
[0139] The rendering types include, but are not limited to, text input question rendering types, single-choice question rendering types, multiple-choice question rendering types, and cascading question rendering types. It's understandable that different rendering types correspond to different extended information. Extended information refers to the data information required to render the question instance as a specific form question on the target form page. For example, it could be a Vue VNode from the Vue front-end framework, or a React Element or string template from the React front-end framework. It's clear that different front-end frameworks used by the target form page will result in different extended information.
[0140] See Figure 4 , Figure 4This is a schematic diagram of an embodiment of the form arrangement device provided in this application. The form arrangement device 10 includes: a first acquisition module 110, a second acquisition module 120, a generation module 130, and a rendering module 140. The first acquisition module 110 is used to acquire multiple question configuration information in the target form; wherein, when the question type of the question configuration information is dynamic, the question configuration information includes dependencies, and the dependencies include dependent question identifiers, which represent the self-question identifiers of the dependent questions; the second acquisition module 120 is used to acquire the self-question identifier and answer identifier group of the current question based on the form data formed by answering the target form; wherein, the answer identifier group includes a first number of answer identifier values; the generation module 130 is used to generate a first number of dynamic question instances based on the answer identifier group of the current question and the target question configuration information in response to the target question configuration information being dynamic and the dependent question identifiers of the dependencies in the target question configuration information matching the self-question identifiers of the current question; the rendering module 140 is used to render and generate the form questions corresponding to the dynamic question instances on the page of the target form based on the dynamic question instances.
[0141] In this embodiment, the form arrangement device 10 obtains multiple question configuration information from the target form; based on the form data formed by answering the target form, it obtains the question identifier and answer identifier group of the current question; in response to the target question configuration information being dynamic question configuration information and the dependent question identifier of the dependent item in the target question configuration information matching the question identifier of the current question, it generates a first number of dynamic question instances based on the answer identifier group of the current question and the target question configuration information; based on the dynamic question instances, it renders and generates the form questions corresponding to the dynamic question instances on the target form page. It can dynamically generate dynamic question instances corresponding to the answer identifier values in the form data based on the form data formed by answering the current question. The number of dynamic question instances is the same as the number of answer identifier values in the form data, realizing real-time interactive dynamic generation of related questions and improving form arrangement efficiency.
[0142] In some embodiments, the generation module 130 includes a selection submodule, a question context generation submodule, and an instance generation submodule. The selection submodule is used to obtain option information corresponding to any answer identifier value in the answer identifier group, and the option information includes at least the option identifier value and the option tag value. The question context generation submodule is used to construct a question context for a dynamic question corresponding to the answer identifier value based on the target question configuration information's own question identifier and its own question tag, as well as the option information corresponding to the answer identifier value. The question context for a dynamic question includes at least the target question identifier, the target question tag, and dynamic source information. The instance generation submodule is used to generate a dynamic question instance corresponding to the answer identifier value based on the question context of the dynamic question and a preset instance template.
[0143] In some embodiments, the question context generation submodule is further configured to generate a target question identifier for the dynamic question based on its own question identifier and option identifier values according to a first parsing rule; and to generate a target question label for the dynamic question based on its own question label and option label values according to a second parsing rule.
[0144] In some embodiments, the form arrangement device 10 further includes a sub-question generation module, which is configured to generate sub-question instances simultaneously when generating a dynamic question instance based on a question context and a preset instance template in response to the target question configuration information having sub-question configuration information; wherein, generating sub-question instances includes: constructing a sub-question context based on the sub-question configuration information and the question context; and generating sub-question instances of the dynamic question instance based on the sub-question context and the instance template.
[0145] In some embodiments, the sub-question generation module is further configured to generate sub-question instances of dynamic question instances while determining the display / hiding result information of the sub-question instances, wherein the display / hiding result information of the sub-question instances is determined by the display / hiding result information of dynamic question instances, the answer identifier group of the current question, and the display / hiding trigger set of the sub-question configuration information.
[0146] In some embodiments, the generation module 130 is further configured to respond to the target question configuration information being question configuration information of the static type, construct a question context corresponding to the static question based on the target question configuration information; wherein, the question context includes at least: its own question identifier and its own question tag; generate a static question instance based on the question context of the static question and a preset instance template; and render and generate the form question corresponding to the static question instance on the page of the target form based on the static question instance.
[0147] In some embodiments, the generation module 130 is further configured to determine the display / hidden result information of the static question instance while generating the static question instance, including: if the target question configuration information includes question display condition information, obtaining the question identifier of the question display condition item indicated by the question display condition information and the question display condition expression; determining the display / hidden result information of the static question based on the form data corresponding to the question identifier of the question display condition item and the question display condition expression; the display / hidden result information includes a display result and a hidden result. The rendering module 140 is further configured to render the form question corresponding to the dynamic question instance in the page of the target form in response to the display / hidden result information indicating a display result; and to skip rendering the form question corresponding to the static question instance in the page of the target form in response to the display / hidden result information indicating a hidden result.
[0148] In some embodiments, the generation module 130 is further configured to: if the question configuration information corresponding to the current question includes question display condition information, determine the display / hidden result information of the current question based on the question display condition information of the current question and the answer identifier group of the current question; in response to the display / hidden result information of the current question indicating that the result is displayed, perform the matching of the dependent question identifier of the target question configuration information with the question identifier of the current question, generate a first number of dynamic question instances and subsequent steps based on the answer identifier group of the current question and the target question configuration information, wherein the display / hidden result information of the dynamic question instance is determined by the question display condition information and form data in the corresponding question configuration information of the dynamic question; in response to the display / hidden result information of the current question indicating that the result is hidden, skip the step of matching the dependent question identifier of the target question configuration information with the question identifier of the current question, and generating a first number of dynamic question instances based on the answer identifier group of the current question and the target question configuration information.
[0149] In some embodiments, the rendering module 140 is further configured to look up corresponding extended information based on the rendering type of the dynamic question instance, wherein different rendering types correspond to different extended information; and to render and generate the form question corresponding to the dynamic question instance in the target form page based on the dynamic question instance and the corresponding extended information.
[0150] In some embodiments, the second acquisition module 120 is used to acquire the question identifier value of the question option corresponding to the current question when the question type of the question configuration information corresponding to the current question is a cascading question type, including the option sub-identifiers corresponding to the sub-questions of the second number of levels; based on the form data formed by the answer target form, to acquire the question identifier and answer identifier group of the current question, including: acquiring the option sub-identifiers of each level of sub-questions corresponding to the current question in the form data, and combining the option sub-identifiers of the second number of levels to form the answer identifier value of the current question.
[0151] See Figure 5 , Figure 5 This is a schematic diagram of another embodiment of the form layout device provided in this application. The device 10 includes: a first acquisition module 110, a second acquisition module 120, a generation module 130, and a rendering module 140. The first acquisition module 110 corresponds to... Figure 5 The form structure and template input layer in the middle, the second acquisition module 120 corresponds to Figure 5 The form data input layer in the middle, corresponding to module 130 Figure 5 The state layer, parsing and orchestration layer, standard protocol layer, and rendering module 140 correspond to these. Figure 5 The rendering layer in the middle.
[0152] Form structure and template input layer: used to obtain the business's declarative form structure (Schema), that is, the form configuration information, which is declared in JSON (JavaScript Object Notation), TOML (Tom's Obvious, Minimal Language) or other ways.
[0153] Specifically, the form configuration information may include question grouping configuration information and question configuration information; among which, the question grouping configuration information includes: question group identifier and question list corresponding to the question group identifier, the question list includes the question identifier of multiple questions; the question configuration information includes fields such as question options, subQuestion configuration information, displayCondition information, and dynamicSource dependency.
[0154] The question types include static and dynamic types. Static types further include: text input question type (text), single choice question type (single_choice), multiple choice question type (multiple_choice), and cascade question type (cascade). Dynamic types further include dynamic repeating single choice question type and dynamic repeating multiple choice question type.
[0155] For the `dynamicSource` field of the dependency, if the question type is dynamic, its question configuration information includes the dependency `dynamicSource`. For example, the dependency `dynamicSource` can be as follows: { "key": "${sourceValue}_service", "label": "Service survey targeting {{sourceLabel}}", "type": "dynamic_repeater_multiple_choice", "dynamicSource": { "dependencyKey": "main_competitors"}, "options": [...] } To support scenarios where sub-questions are provided under a question, such as providing "other" supplementary input questions, a subQuestion field can be added to the question configuration information. This subQuestion configuration information can include its own question identifier key, its own question label, triggerValues set, and other additional information such as config.
[0156] Among them, the sub-question key in the sub-question configuration information can be set to the sub-question key template by default, such as ${questionKey}_other, which is automatically derived from the target question key in the context of the parent question during parsing.
[0157] The `triggerValues` set (set at declaration) is used to calculate the visibility information of sub-questions. For example, the visibility information of a sub-question can be calculated based on the rule: `parent.visible && parentValues ∩ triggerValues ≠`. Here, `parent.visible` represents the visibility information of the parent question, `parentValues` represents the selected items of the parent question, `&&` represents the logical AND operation, and `∩` represents the intersection operation.
[0158] The SchemaParser form parser is used to traverse the question configuration information, building a three-layer cache in one traversal: question grouping mapping (categoryMap), question mapping (questionMap), and option mapping (optionMap). At the same time, it triggers the SchemaValidator to perform legality verification on the generated three-layer cache through the subscriber notification pattern, and triggers the InitSchemaUtils to populate the generated three-layer cache with default values.
[0159] The `questionMap` mapping has the key of each question and the corresponding value of its configuration information (including the question identifier key, the question label, the question type, the dependency `dynamicSource`, the question options, and the question display condition `displayCondition`). The `categoryMap` mapping has the key of each question group and the corresponding value of a list of questions composed of their respective identifiers. The `optionMap` mapping has the key of each question and the corresponding value of `Map<question options, option information>`, representing a two-level mapping. The inner `option information` includes the option identifier value and the option label value, providing complete information related to the question options.
[0160] When the question type is a cascading question type, the SchemaParser form parser, during the recursive construction of the corresponding option mapping relationship, records the option tag value in the option information for each question option, specifically the option cascading path `parentValue`. Through this option cascading path, the hierarchical structure of the question options can be traced back. When querying the option mapping relationship `optionMap`, it returns the complete option information `OptionInfo`, ensuring that the displayed text of the generated dynamic questions can be pieced together to reveal the complete cascading meaning.
[0161] In cascading question types, such as cascading multiple-choice questions (multi-level dropdowns), the question type provides users with cascading sub-options. The complete path formed by concatenating the selected options (i.e., the answer) after the user selects from each level of sub-options is called the cascading option path. Separators can be used to separate the sub-options at each level within the cascading option path. For example, a question used for consulting about professional identity might be a three-level cascading question. The first-level sub-option is "Enterprise," the second-level sub-option is "Listed Company Management," and the third-level sub-option is "CFO." The cascading option path would be: "enterprise.listed_company_management.cfo". The `contains` operator can be used in conditional statements to check if a specific sub-path is included within the cascading path.
[0162] Form data input layer: used to receive form data; the form data is a snapshot of the current state of the target form, which is updated after each user operation (input / selection / clear). The orchestrator receives the latest form data and recalculates the display and hidden results information of all questions.
[0163] The form data consists of key-value pairs. The key is the target question identifier key (e.g., "major_competitors") of the questions in the target form, and the value is the answer identifier group corresponding to the target question identifier key. It can be understood that the target question identifier key in the target form refers to the target question identifier key of the corresponding question instance, specifically generated based on the question's own question identifier in the question configuration information. The answer identifier group includes a first number of answer identifier values, which can be of string type. For example, for text input questions, the answer identifier value is the string representing the text input content; for single-choice questions, the answer identifier value is the string representing the selected question option; and for multiple-select questions, the answer identifier value is the string array representing the selected question option.
[0164] State layer: Used to monitor changes in form data and determine whether to trigger a reflow. Specifically, it can include functions such as change monitoring, debouncing, incremental changes, and event notifications. Monitoring changes refers to monitoring changes in form data.
[0165] Debouncing refers to setting up a debouncing mechanism with a defined debouncing time period (e.g., 200ms, 300ms). During this time period, continuous user actions on the target form (e.g., quickly selecting and then deselecting question options) will not trigger immediate arrangement; instead, the arrangement will wait until the actions cease. If there is no user action during the debouncing time period, arrangement will be triggered.
[0166] Incremental update: After debouncing is triggered, the orchestrator is invoked. Since a cache has been built, the orchestrator uses the cache to quickly calculate and output only the changed parts or the full latest configuration (depending on the strategy).
[0167] Event notification: New form layout configuration information is pushed to the rendering layer via pre-configured events. These pre-configured events correspond to the latest configuration, either partially or fully, as output by the arranger. New form layout configuration information can include static question instances, dynamic question instances, and sub-question instances.
[0168] The FormOrchestrator is used to quickly determine whether each question needs to be regenerated based on the form data, and outputs new form orchestration configuration information with pre-configured events. The rendering layer re-renders according to the new form orchestration configuration information, and can naturally complete the minimal update by using virtual DOM diff (Document Object Model diff).
[0169] Specifically, the orchestrator receives the current form data and iterates through the question mapping relationship (questionMap). For each question, it determines whether the question type is dynamic or static based on its question configuration information and follows two processing paths respectively.
[0170] For static question types, the configuration information directly generates the corresponding static question instance.
[0171] The question type is dynamic. The question configuration information (dynamic repeater) is obtained from the form data. The selected question options under the question (i.e. dependent question) indicated by the dependent question identifier of its dependency are obtained, and N independent dynamic question instances are dynamically generated.
[0172] For example, if a user selects "Competitor 1" and "Competitor 2", then two independent questions will be dynamically generated: "The main service used by the competitor (Competitor 1)" and "The main service used by the competitor (Competitor 2)".
[0173] The processing steps of the dynamic repeater include: retrieving the dependencyKey of the dependent question (corresponding to the current question when the dynamic repeater is running) from the question configuration information; searching for the complete question configuration information of the dependent question in the question mapping relationship questionMap in O(1); obtaining the answer identifier group corresponding to the dependent question from the form data, the answer identifier group includes the first number of answer identifier values, which are uniformly normalized into an array of answer identifier values.
[0174] For each answer identifier value, retrieve the option information OptionInfo from the option mapping relationship optionMap in O(1). Then, construct an independent dynamic question context based on the option information and question configuration information. The dynamic question context includes at least: target question identifier, target question tag, and dynamic source information. Use the template resolver TemplateResolver to generate an independent dynamic question instance based on the dynamic question context.
[0175] For example, the QuestionContext for dynamic questions (only partial configuration information is shown) is: { source:{sourceValue, sourceLabel, dependencyKey}, questionKey, questionLabel, conditionValue, value}} in, source: Dynamic source information, the source of the question context (QuestionContext).
[0176] sourceValue: Identifies configuration parameters and is updated to option identifier value (option.value). It is machine readable, such as "abc", and is used to generate a unique question key.
[0177] sourceLabel: Label configuration parameter, updated to the option label value, such as "Competitor 1", used to generate user-readable title.
[0178] dependencyKey: The problem identifier of the current problem itself.
[0179] questionKey: The target question identifier, which is generated by parsing the first template syntax. It is newly generated and used to identify a specific dynamic question.
[0180] For example, the target question's own question identifier is "${sourceValue}_service", where "sourceValue" is the first identifier and "service" is the second identifier. The first template syntax ${varName1} combines the first identifier "sourceValue" and the second identifier "service", with varName1 representing the parameter in the first template syntax. The option identifier sourceValue corresponding to the answer identifier value is updated to "abc", and parsed to form a new target question identifier questionKey: "abc_service".
[0181] questionLabel: The target question label, generated by parsing the second template syntax, is a newly generated title that is actually displayed for the specific dynamic question.
[0182] For example, the target question's own question label is "Service Survey for {{sourceLabel}}", where "sourceLabel" is the first part of the label and "Service for..." is the second part. The second template syntax {{varName2}} combines the first part "sourceLabel" and the second part "Service for...", with varName2 representing the parameter in the second template syntax. The option label sourceLabel corresponding to the answer identifier value is updated to "Competitor 1", and a new target question label questionLabel is generated: "Service Survey for Competitor 1".
[0183] conditionValue: The answer identifier value for the current question, obtained from the form data, is used to perform a Boolean comparison by substituting it into the condition operator and operand values rules in the displayCondition condition for the question.
[0184] value (visible, corresponding to the visibility result information of the dynamic question): Boolean result after boolean judgment. true means that the dynamic question is visible to the user, and false means that the dynamic question is not visible to the user and is in a hidden state.
[0185] Furthermore, a unified question context, QuestionContext, is constructed for both static and dynamic questions. Before calling the TemplateParser rule register, the dynamic source information of the QuestionContext is flattened to the top level of the context, ensuring that data nesting is not a concern when using the first template syntax or the second template syntax for parsing. This allows static and dynamic questions to share the same parsing logic.
[0186] The TemplateResolver is a template parser used to generate an independent static or dynamic question instance based on the question configuration information and the question context (QuestionContext) using the TemplateParser rule registry.
[0187] Furthermore, to support additional input scenarios such as "other", when the parent question itself is a dynamic question, the child question instances of each dynamic question instance are independently derived to obtain the child question identifiers of the first number of non-conflicting child question instances, without the need for additional configuration throughout the process.
[0188] Dynamic problem instance generation, template variable parsing, and sub-problem instance derivation are all completed within the same template resolver process: the dynamic repeater simply calls the resolver repeatedly and feeds in different problem contexts, without any additional "dedicated code path for dynamic problems". This avoids multi-level nested dynamic generation logic.
[0189] TemplateParser, a rule registry, is used to manage various parsing rules through a rule registration mechanism.
[0190] The ConditionEvaluator is used to evaluate conditions through a Map.<operator, EvaluationRuleFn> Maintain a set of conditional operator rules, and determine the display and hidden results of sub-question instances by using the judgment logic preset in the question configuration information and form data.
[0191] For example, it can be provided by default:
[0192] Before execution, all operators undergo array-based processing (e.g., using the `normalizeArray` array normalization function) to normalize the value type (single values are automatically wrapped into single-element arrays), eliminating the difference between how callers handle "scalar vs. array". Business users can extend custom operators through a registration mechanism.
[0193] Standard Protocol Layer: Generates static or dynamic question instances based on the question context and instance template. This process is independent of the UI (User Interface). The instance template includes the target question identifier, target question tag, rendering type, and display / hidden result information. It may also include dynamic source information, option type, whether it is dynamically generated, and whether it is a sub-question. For example: QuestionConfig { key: string label: string type: QuestionType visible: boolean options?: BaseOption[] | CascadeOption[] config?: BaseQuestionConfig Question: Question isDynamicGenerated?: boolean dynamicSource?: { sourceValue, sourceLabel, dependencyKey} isSubQuestion?: boolean } Wherein, ? indicates an optional attribute, QuestionType corresponds to the rendering type, which is obtained by mapping the question type from the target question configuration information. The rendering type includes, but is not limited to, text input question rendering type, single-choice question rendering type, multiple-choice question rendering type, and cascading question rendering type, avoiding the rendering end's awareness of the dynamic generation mechanism. Question corresponds to the original question reference (for extended use). This protocol is independent of specific UI frameworks: it does not depend on Vue or React's VNode, and it is not bound to specific component libraries (such as Element Plus or Ant Design).
[0194] Rendering layer: The RenderEngine extension engine looks up the extension corresponding to the question type in the Renderer extension registry for rendering; the extension is implemented according to standard protocols, is framework-independent, and can be adapted to Vue extension collection, React extension collection, and mobile extension collection.
[0195] The registration mechanism maintains an extension or component mapping table (Map).<questionType, Extension> `questionType` is the type corresponding to the extension, and `Extension` is either an extension or a component. The extension is searched in the extension mapping table; if not found, it falls back to the static extension type.
[0196] Each extension implements the `render(questionConfig, options)` interface; when integrating with the UI library, it only needs to implement the corresponding extension for the rendering type. An additional layer of extension handles container logic such as title and error display uniformly.
[0197] This embodiment implements: declarative schema; field-level reactive linkage (value / state); dynamic question instantiation (one-choice, multiple generation); driving the first number of independent dynamic question instances based on the answer value of the current question; dual-template syntax (semantic separation of self-question identifier and self-question tag); template / operator rules can be registered and extended; automatic derivation of sub-question instances; unified arrangement of three-level cascading (static question instance, dynamic question instance, and sub-question instance) display and hidden result information; the static question instance, dynamic question instance, and sub-question instance output by the arrangement are independent of the UI framework; cross-framework adaptation (Vue / React / Mini Program); single-pass three-level caching and subscriber verification to achieve O(1) query. Questionnaire questions, dependencies, and display / hidden conditions can be quickly adjusted through pure configuration (without release). The same form arrangement engine can serve both PC (Vue 3 + Element-Plus system) and mobile CRM (mobile component library) at the same time, and has the ability to adapt to cross-frameworks in the future. Since the static question instances, dynamic question instances, and sub-question instances output by the orchestration do not involve any framework runtime type, the return value of Extension.render is determined by the extension itself (it can return a Vue VNode, a React Element, or a string template). The engine is only responsible for scheduling and does not directly hold the DOM. Therefore, when integrating with different frameworks such as Vue 3, React, and Mini Programs, only one set of corresponding extension collections needs to be implemented, without rewriting the orchestration logic.
[0198] See Figure 6 , Figure 6 yes Figure 5A schematic diagram of the device's operating timing. It includes the following workflow: S51: Select the first number of options in the current question.
[0199] The form data input layer parses the form data, which includes the question identifier of the current question and the answer identifier group corresponding to the current question. The answer identifier group includes a first number of answer identifier values.
[0200] S52: Anti-shake triggers re-arrangement.
[0201] Monitor changes in form data to determine if a reflow is triggered.
[0202] S53: Identify dynamic repeaters.
[0203] The FormOrchestrator identifies whether the question type is static or dynamic (dynamic repeater).
[0204] S54: Retrieve the question configuration information for the current question.
[0205] In response to the dynamic repeater, the question configuration information for the current question is retrieved from the mapping table cached by the SchemaParser form parser in O(1) query time complexity.
[0206] S55: Retrieve the problem configuration information for the current problem.
[0207] The SchemaParser form parser returns the question configuration information for the current question to the FormOrchestrator.
[0208] S56: Normalize the first number of answer identifier values into an array.
[0209] Normalize the first number of answer identifier values into an array. For example, if the first number is N, the answer identifier group corresponding to the current question includes v1...vN answer identifier values. For each answer identifier value vi, loop through and execute: S57: Locate OptionInfo information.
[0210] The OptionInfo information for the answer identifier value vi is retrieved from the mapping table cached by the SchemaParser form parser in O(1) query time complexity.
[0211] S58: Get option information OptionInfo.
[0212] The SchemaParser form parser returns the OptionInfo information (including option identifier value, option label, and cascading path parentValue) to the FormOrchestrator.
[0213] S59: Construct an independent problem context.
[0214] The FormOrchestrator arranger constructs independent topic contexts.
[0215] S60: Generate dynamic question instances based on the question context and preset instance templates.
[0216] Using the TemplateResolver template resolver, dynamic problem instance generation, template variable parsing, and sub-problem instance derivation are all completed in the same templateResolver.resolve(template, context) process.
[0217] S61: Parse the target question identifier and target question tag of dynamic question instances.
[0218] Using the TemplateParser rule registrar, based on the first parsing rule corresponding to the first template syntax, the first part of the identifier of the target question configuration information, namely the identifier configuration parameter, is identified. The identifier configuration parameter is then updated to the option identifier value in the option information to form the target question identifier of the dynamic question. Based on the second parsing rule of the second template syntax, the first part of the tag of the target question configuration information, namely the tag configuration parameter, is identified. The tag configuration parameter is then updated to the option tag value in the option information to form the target question tag of the dynamic question.
[0219] S62: Returns the problem identifier and problem tag of the dynamic problem instance.
[0220] The TemplateParser rule registry returns the updated dynamic problem instance's own problem identifier and its own problem tag.
[0221] S63: Determine the explicit / implicit result information of a dynamic question instance and generate a sub-question instance.
[0222] The TemplateResolver determines whether the results are explicit or implicit, and generates sub-question instances.
[0223] S64: Output dynamic problem instances and sub-problem instances.
[0224] The TemplateResolver outputs dynamic problem instances and sub-problem instances.
[0225] S65: Aggregate and output all dynamic problem instances and sub-problem instances.
[0226] The FormOrchestrator arranger brings together and outputs all dynamic title instances and subtitle instances.
[0227] S66: Triggers re-rendering.
[0228] For example, the current question has a key "major_competitors", a label "major competitors / service providers", and a cascade question type. The question configuration information also includes a questionConfig item, which contains a multiple-choice flag. The flag "true" indicates that the current question is a multiple-choice question. The options have two levels. If the user selects the option "bank" from the first level, the cache records the first-level option's flag as "financial_institution.bank". If the user selects two options from the second level, "XX Bank" and "XX Group", the cascade paths "financial_institution.bank.hsbc_bank" and "financial_institution.bank.ubs" are formed. Some examples are shown below: [[profile_survey.categories.questions]] key = "major_competitors" label = "Main Competitors / Service Providers" type = "cascade" [profile_survey.categories.questions.questionConfig] multiple = true [[profile_survey.categories.questions.options]] value = "financial_institution.bank" label = "Bank" [[profile_survey.categories.questions.options.children]] value = "financial_institution.bank.hsbc_bank" label = "XX Bank" [[profile_survey.categories.questions.options.children]] value = "financial_institution.bank.ubs" label = "XX Group".
[0229] After the user selects two cascading options for the current question, the FormOrchestrator retrieves the form data and searches for the target question configuration information. The dependency key of the `dynamicSource` item in the target question configuration information matches the question identifier of the current question. The question type in the target question configuration information is dynamic, specifically a dynamic repeated multiple-select question type. The target question configuration information also includes a question configuration item `questionConfig`, which includes an interaction method identifier `variant`. The `variant` corresponds to "checkbox", indicating a checkbox configuration. The target question configuration information also includes subquestion configuration information. Based on the answer identifier group of the current question and the target question configuration information, two dynamic question instances are generated. Subquestion instances are generated simultaneously with the dynamic question instances. Some examples are shown below: [[profile_survey.categories.questions]] key= "competitors_main_services_${sourceValue}" label = "Competitors' main services (${sourceLabel})" type= "dynamic_repeater_multiple_choice" [profile_survey.categories.questions.questionConfig] variant = "checkbox" [profile_survey.categories.questions.dynamicSource] dependencyKey = "major_competitors" [profile_survey.categories.questions.subQuestion] triggerValues = ["other"] [[profile_survey.categories.questions.options]] value = "trust"; label = "trust" [[profile_survey.categories.questions.options]] value = "stock_trading"; label = "Stock Trading" [[profile_survey.categories.questions.options]] value = "derivatives"; label = "derivatives" [[profile_survey.categories.questions.options]] value = "crypto_assets"; label = "crypto assets" [[profile_survey.categories.questions.options]] value = "other"; label = "other".
[0230] The FormOrchestrator editor outputs static question instances corresponding to the current question. Some examples are shown below: { key:"major_competitors", label:"Main Competitors / Service Providers", type:"cascade", visible:true, ...}.
[0231] The FormOrchestrator editor outputs two dynamic question instances, corresponding to the dynamic question instances of the "XX Bank" selected by the user. Some examples are shown below: {key:"competitors_main_services_financial_institution.bank.hsbc_bank", label: "Competitor's main service (XX Bank)" type:"multiple_choice", visible:true, isDynamicGenerated:true, dynamicSource: { sourceValue:"financial_institution.bank.hsbc_bank", sourceLabel:"XX Bank", dependencyKey:"major_competitors"} }
[0232] While generating a dynamic question instance corresponding to the "XX Bank" selected by the user, corresponding sub-question instances are also generated. Some examples are shown below: { key:"competitors_main_services_financial_institution.bank.hsbc_bank_other", label:"Please enter another", type:"text", visible: false, isSubQuestion:true}.
[0233] The FormOrchestrator editor outputs two dynamic question instances, corresponding to the dynamic question instances of the user-selected "XX Group". Some examples are shown below: { key:"competitors_main_services_financial_institution.bank.ubs", label: "Competitors' main services (XX Group)" type:"multiple_choice", visible:true, isDynamicGenerated:true, ...}.
[0234] While generating a dynamic question instance corresponding to the "XX Group" selected by the user, corresponding sub-question instances are also generated. Some examples are shown below: {key:"competitors_main_services_financial_institution.bank.ubs_other", label:"Please enter another", type:"text", visible: false, isSubQuestion:true}.
[0235] When a user enters the target form page, the dynamic question instance has not yet been generated. After the user selects two options for the current question, the orchestrator instantiates two dynamic question instances and two sub-question instances in a single call. When the user selects crypto_assets and other in the dynamic question corresponding to "XX Bank": the display / hidden result information for the sub-question instance corresponding to "XX Bank" is calculated as true (based on triggerValues=["other"] ∩ the current selection is not empty). If the user does not select other in the dynamic question corresponding to "XX Group", the display / hidden result information for the sub-question instance corresponding to "XX Group" is calculated as false, keeping visible: false, and the display / hidden result information of the two sub-question instances does not interfere with each other. If the user unchecks "XX Bank" in the current question, the dynamic question instance and sub-question instance corresponding to "XX Bank" will no longer be generated in the next orchestration (question instance destroyed). The data already filled in by the user in the "XX Bank" sub-question is determined by the outer state management layer based on the sub-question identifier to be retained or cleared (business strategy is configurable).
[0236] See Figure 7 , Figure 7 yes Figure 5 A schematic diagram illustrating the workflow of the rule registrar in the device. The TemplateParser rule registrar is used to manage various parsing rules through a rule registration mechanism, as shown in the example below:
[0237] The parsing rule can be a regular expression. For example: parsing rule / \ <equation>\{([^}]+)\} / g is used to match the template syntax ${varName}, capturing varName. Different characters form different parsing rules.
[0238] The two template syntaxes can coexist in the same string without interfering with each other because they are registered independently during the parsing phase and each matches a different template syntax.
[0239] Users can register parsing rules with the TemplateParser rule registry to create custom parsing rules. Each parsing rule includes a rule name (name) and a parsing rule (ParseRule). The rule registry establishes and maintains a mapping relationship between the rule name (name) and the parsing rule (ParseRule): Map<name, ParseRule> The parsing rules include the parsing pattern. For example: parser.registerRule({ name: 'angle', pattern: / <<([^>>]+)>> / g, extractVarName: m =>m[1], }) Business users can register new template syntax (such as <<>>, @@@) as needed without modifying the engine source code. Selective application of parsing rules is supported during parsing.
[0240] For example, the target question configuration information may contain the question identifier "competitors_main_service_${sourceValue}" and the question label "competitors' main service ({{sourceLabel}})".
[0241] In the dynamic source information of the question context, the identifier configuration parameters are updated to the option identifier values, and the label configuration parameters are updated to the option label values. For example, the question context includes {sourceValue: "abc", sourceLabel: "xx Group", ...}.
[0242] The TemplateParser rule registry parses the code. Based on the first parsing rule corresponding to the first template syntax, it identifies the first part of the target question's own question identifier in the target question configuration information, i.e., the identifier configuration parameter. It updates the identifier configuration parameter to the option identifier value in the option information, forming the target question identifier for the dynamic question, for example: competitors_main_service_abc. Based on the second parsing rule of the second template syntax, it identifies the first part of the target question's own question tag in the target question configuration information, i.e., the tag configuration parameter. It updates the tag configuration parameter to the option tag value in the option information, forming the target question tag for the dynamic question, for example: competitors mainly use services (xx Group). All parsing rules are applied sequentially. The same string can contain both template syntaxes simultaneously.
[0243] The question identifier in the question configuration information can carry both text expression and placeholder, for example, ${dependencyKey}_${sourceValue}_other.
[0244] See Figure 8 , Figure 8 yes Figure 5 A schematic diagram of the working process of the condition evaluator in the device.
[0245] The question configuration information includes the expected set of results required for static questions, dynamic questions, and sub-questions, as well as the display condition expression.
[0246] The process of determining the display / hiding result of a static question instance includes: based on the option identifier value corresponding to the static question in the form data, substituting it into the question display condition expression in the question configuration information corresponding to the static question, and using the result of the question display condition expression as the display / hiding result information of the static question instance. The question configuration information corresponding to the static question includes the question display condition information `displayCondition`, which can include the question identifier `displayCondition.questionKey`, the question display condition expression, and the condition operator `operator` and operands `values`, where `values` includes the expected set.
[0247] The process of determining the display / hiding result of a dynamic question instance includes: Substituting the option identifier value of the dependent question corresponding to the dynamic question instance in the form data into the question display condition expression in the question configuration information of the dependent question, and using the result of the question display condition expression as the display / hiding result information of the dependent question. If the display / hiding result information of the dependent question indicates that the result is to be displayed, a dynamic question instance is generated, and the display / hiding result information of the dynamic question instance is calculated based on the question display condition expression in the question configuration information of the dynamic question and the option identifier value corresponding to the dynamic question. If the display / hiding result information of the dependent question indicates that the result is to be hidden, the dynamic question instance generation process is skipped.
[0248] The visibility of sub-problem instances is determined through conditional logic. For example: using the conditional logic `parent.visible && parentValues ∩ triggerValues ≠` In this context, `parent.visible` represents the explicit / implicit result information of a dynamic or static question instance, `parentValues` represents the answer identifier group corresponding to the question of the dynamic or static question instance, `triggerValues` represents the explicit / implicit trigger set, `&&` is the logical AND operation, and `∩` is the intersection operation. If parent.visible is the visible result and at least one of parentValues and triggerValues is the same, then the visible / hidden result information of the sub-topic instance represents the visible result.
[0249] The determination of the above-mentioned display / hidden result information is completed during the arrangement stage, and the final output is the display / hidden result information for static question instances, dynamic question instances, and sub-question instances. The rendering layer only needs to read the display / hidden result information to decide whether to render, thus achieving complete separation between the display / hidden logic and the rendering logic.
[0250] See Figure 9 , Figure 9 yes Figure 5 A schematic diagram of the form parser's workflow in the device. The form parser groups each question and performs the following steps: The `onCategory` method notifies stakeholders associated with the question group, such as validators, initializers, and translators. Stakeholders can then perform validation, initialization, and other operations on the question group.
[0251] Construct a question grouping mapping relationship, where the key is the question group key and the corresponding value is a list of questions consisting of their own question identifiers. For example, use `categoryMap[category.key] = category` to construct the question grouping mapping relationship, where `category` includes a list of questions consisting of their own question identifiers.
[0252] For each problem in the currently visited problem group, perform the following steps: Notify the relevant stakeholders of the question in the onQuestion event, such as validators and initializers. Validators validate the question, and initializers initialize the question or fill it with default values.
[0253] Construct a question mapping relationship, where the key is the question's own question identifier, and the corresponding value is the question's configuration information. For example, use `questionMap[question.key] = question` to construct the question mapping relationship, where `question` is the question configuration information (including fields such as the question identifier `key`, the question label, the question type `type`, the dependency `dynamicSource`, the question options `options`, and the question display condition information `displayCondition`).
[0254] For each question option under the currently visited question, perform the following steps: The notification option is associated with the onOption method, such as a validator. The validator validates the option, checking the uniqueness of the option identifier value, cascading paths, etc.
[0255] An option mapping relationship is constructed, where the key is the question identifier of the currently traversed question, and the corresponding value is a Map<question options, option information OptionInfo>. For example, optionMap[questionKey][value]=OptionInfo is used to construct the option mapping relationship. The option information OptionInfo includes complete information related to the question options, such as the option identifier value and option tag value. When the options are cascading options, the cascading path is cached, and it is checked whether there are options at the next level. If so, the process continues to notify the associated parties and construct the option mapping relationship.
[0256] By using the subscriber pattern (e.g., question grouping associated onCategory, question associated onQuestion, option associated onOption), the processes of validation, default value filling, and text conversion are combined into the same traversal. By utilizing the constructed question grouping mapping relationship, question mapping relationship, and option mapping relationship, the question configuration information related to questions and options can be quickly searched. The time and space complexity of the retrieval is O(1), avoiding multiple searches for question configuration information.
[0257] See Figure 10 , Figure 10 yes Figure 5 A schematic diagram of the rendering engine workflow in the device.
[0258] The RenderEngine receives static question instances, dynamic question instances, and sub-question instances. Based on the rendering type of the question instance, it looks up the corresponding extended information; different rendering types correspond to different extended information. Based on the question instance and its corresponding extended information, it renders and generates the form question corresponding to the question instance on the target form page. The RenderEngine searches for extended information according to the rendering type in the question instance, retrieving the corresponding extended information from the rendering extended table. The rendering extended table maintains a mapping between rendering types and extended information, and is linked to different extended information.
[0259] See Figure 11 , Figure 11 This is a schematic diagram of one embodiment of the electronic device provided in this application. The electronic device 20 includes a coupled memory 220 and a processor 210. The memory 220 stores program instructions, and the processor 210 is used to execute the program instructions to implement the methods provided in any embodiment and any non-conflicting combination of the methods described above in this application.
[0260] Processor 210 can be an integrated circuit chip with signal processing capabilities. Processor 210 can be a general-purpose processor, including but not limited to: CPU (Central Processing Unit), NP (Network Processor), etc.; it can also be DSP (Digital Signal Processor), ASIC (Application Specific Integrated Circuit), FPGA (Field-Programmable Gate Array), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0261] The memory 220 can be a non-volatile memory, such as ROM (Read-Only Memory), RAM (Random Access Memory), or other memory.
[0262] See Figure 12 , Figure 12 This is a schematic diagram of one embodiment of the computer storage medium provided in this application. The computer-readable storage medium 30 stores program instructions 310, which can be executed to implement the methods provided in any embodiment and any non-conflicting combination of the methods described above. The program instructions 310 can be formed into a program file and stored in the storage medium 30 as a software product, so that a computer device (which may be a personal computer, server, or network device, etc.) can execute all or part of the steps of the methods of various embodiments of this application. The aforementioned storage medium 30 includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks, or terminal devices such as computers, servers, mobile phones, and tablets.
[0263] The above description is merely an embodiment of this application and does not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.< / equation>
Claims
1. A form layout method, characterized in that, The method includes: Obtain multiple question configuration information from the target form; wherein, when the question type of the question configuration information is dynamic, the question configuration information includes dependencies, the dependencies include dependent question identifiers, and the dependent question identifiers represent the question identifiers of the dependent questions themselves; Based on the form data generated by answering the target form, obtain the question identifier and answer identifier group of the current question; wherein, the answer identifier group includes a first number of answer identifier values; In response to the target question configuration information being a question configuration information of the dynamic type and the dependent question identifier of the dependent item in the target question configuration information matching the question identifier of the current question, the first number of dynamic question instances are generated based on the answer identifier group of the current question and the target question configuration information; Based on the dynamic question instance, the form question corresponding to the dynamic question instance is rendered and generated on the target form page.
2. The method according to claim 1, characterized in that, The question configuration information includes its own question identifier and its own question tags; The step of generating the first number of dynamic question instances based on the answer identifier group of the current question and the target question configuration information includes: For any answer identifier value in the answer identifier group, obtain the option information corresponding to the answer identifier value, wherein the option information includes at least the option identifier value and the option tag value; Based on the target question configuration information, its own question identifier and its own question tag, and the option information corresponding to the answer identifier value, a question context for a dynamic question corresponding to the answer identifier value is constructed. The question context for the dynamic question includes at least: target question identifier, target question tag, and dynamic source information. Based on the question context of the dynamic question and the preset instance template, a dynamic question instance corresponding to the answer identifier value is generated.
3. The method according to claim 2, characterized in that, Based on the target question configuration information's own question identifier and own question tag, and the option information corresponding to the answer identifier value, a question context for the dynamic question corresponding to the answer identifier value is constructed, including: According to the first parsing rule, the target question identifier of the dynamic question is generated based on its own question identifier and option identifier value; According to the second parsing rule, the target question tag of the dynamic question is generated based on its own question tag and option tag value.
4. The method according to claim 2, characterized in that, The question configuration information also includes sub-question configuration information, which includes its own sub-question identifier and its own sub-question tag; After constructing the question context of the dynamic question corresponding to the answer identifier value based on the self-question identifier and self-question tag of the target question configuration information, and the option information corresponding to the answer identifier value, the method further includes: In response to the target question configuration information having sub-question configuration information, when generating a dynamic question instance based on the question context and a preset instance template, sub-question instances are generated simultaneously. The examples of generated sub-questions include: Based on the sub-topic configuration information and the topic context, a sub-topic context is constructed; Based on the sub-question context and the instance template, a sub-question instance of the dynamic question instance is generated.
5. The method according to claim 4, characterized in that, The sub-question configuration information also includes a display / hide trigger set, and the sub-question instance also includes display / hide result information. The display / hide result information of the sub-question instance is determined by the display / hide result information of the dynamic question instance, the answer identifier group of the form question corresponding to the dynamic question instance, and the display / hide trigger set of the sub-question configuration information.
6. The method according to claim 1, characterized in that, The method further includes: In response to the fact that the target question configuration information is of the static type, a question context corresponding to the static question is constructed based on the target question configuration information; wherein, the question context includes at least: its own question identifier and its own question tag; Based on the question context of the static question and the preset instance template, the static question instance is generated; Based on the static question instance, the form question corresponding to the static question instance is rendered and generated on the target form page.
7. The method according to claim 6, characterized in that, Static question examples include both explicit and implicit result information; The process of generating static question instances based on the question context of the static question and a preset instance template includes: If the target question configuration information includes question display condition information, obtain the question identifier and question display condition expression of the question display condition item indicated by the question display condition information; Based on the form data corresponding to the question identifier in the question display condition item, and the question display condition expression, determine the display / hiding result information of the static question instance; the display / hiding result information includes the display result and the hidden result; The step of rendering and generating form questions corresponding to the static question instance on the target form page based on the static question instance includes: In response to the indication that the result should be displayed, the form question corresponding to the static question instance is rendered and generated on the page of the target form. In response to the indication that the result is hidden, skip the static question instance and render the form question corresponding to the static question instance on the page of the target form.
8. The method according to claim 1, characterized in that, The question configuration information also includes question display condition information, and the dynamic question instance also includes display / hide result information; Before generating the first number of dynamic question instances based on the answer identifier group of the current question and the target question configuration information, which is dynamic question configuration information and whose dependent question identifiers match the question identifier of the current question, the method further includes: If the question configuration information corresponding to the current question includes question display condition information, the display / hidden result information of the current question is determined based on the question display condition information of the current question and the answer identifier group of the current question; In response to the current question's display result information indicating that the result is to be displayed, the process of matching the dependent question identifier in response to the target question configuration information with the current question's own question identifier is performed. Based on the current question's answer identifier group and the target question configuration information, the first number of dynamic question instances and subsequent steps are generated. The display result information of the dynamic question instance is determined by the question display condition information in the corresponding question configuration information of the dynamic question instance and the form data. In response to the current question's explicit / implicit result information indicating that the result is hidden, the execution of the step of matching the dependent question identifier with the current question's own question identifier in response to the target question configuration information is skipped. Based on the current question's answer identifier group and the target question configuration information, the first number of dynamic question instance steps are generated.
9. The method according to claim 1, characterized in that, The dynamic question instance also includes a rendering type, which is obtained by mapping the question type from the target question configuration information; the step of rendering and generating the form question corresponding to the dynamic question instance on the target form page based on the dynamic question instance includes: Based on the rendering type of the dynamic question instance, the corresponding extended information is searched, where different rendering types correspond to different extended information; Based on the dynamic question instance and its corresponding extended information, the form question corresponding to the dynamic question instance is rendered and generated on the target form page.
10. The method according to claim 1, characterized in that, When the question type of the question configuration information corresponding to the current question is a cascading question type, the option identifier value of the question option corresponding to the current question includes the option sub-identifiers corresponding to the question sub-options of the second number of levels; The step of obtaining the question identifier and answer identifier group for the current question based on the form data generated from answering the target form includes: Obtain the option sub-identifier of each level of question sub-options corresponding to the current question in the form data, and combine the option sub-identifiers of the second number of levels to form the answer identifier value of the current question.
11. A form formatting device, characterized in that, include: The first acquisition module is used to acquire multiple question configuration information from the target form; wherein, when the question type of the question configuration information is dynamic, the question configuration information includes dependencies, the dependencies include dependent question identifiers, and the dependent question identifiers represent the question identifiers of the dependent questions themselves. The second acquisition module is used to acquire the question identifier and answer identifier group of the current question based on the form data formed by answering the target form; wherein, the answer identifier group includes a first number of answer identifier values; The generation module is configured to, in response to the target question configuration information being dynamic question configuration information and the dependent question identifier of the dependent item in the target question configuration information matching the question identifier of the current question, generate the first number of dynamic question instances based on the answer identifier group of the current question and the target question configuration information. The rendering module is used to render and generate the form question corresponding to the dynamic question instance on the page of the target form based on the dynamic question instance.
12. An electronic device, characterized in that, The electronic device includes a coupled memory and a processor, the memory storing program instructions, and the processor executing the program instructions to implement the form arrangement method as described in any one of claims 1-10.
13. A computer-readable storage medium, characterized in that, The computer-readable storage medium is used to store program instructions that can be executed to implement the form layout method as described in any one of claims 1-10.
