Formula editing method and related device

By introducing input and reference areas into the formula editing component, and displaying candidate formula elements in response to cursor movement, the problem of low editing efficiency caused by using all elements is solved, resulting in more efficient formula input and a better user experience.

CN122064262APending Publication Date: 2026-05-19TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
TENCENT TECHNOLOGY (SHENZHEN) CO LTD
Filing Date
2024-11-18
Publication Date
2026-05-19

AI Technical Summary

Technical Problem

In existing technologies, the use of all formula elements in the formula editing component leads to inefficient selection of formula elements, affecting editing efficiency and causing lag, thus impacting the user experience.

Method used

It provides a formula editing component that includes an input area and a reference area. In response to cursor movement, it displays candidate formula elements supported by the current cursor position in the reference area and the selected target formula element in the input area, reducing interference from useless elements and simplifying the input method.

Benefits of technology

It improves formula editing efficiency, reduces the possibility of editing errors, and enhances the user experience of the product.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122064262A_ABST
    Figure CN122064262A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computers, and provides a formula editing method and a related device.The formula editing method is used for improving formula editing efficiency, and the method comprises the steps that a formula editing assembly comprising an input area and a reference area is provided for a target object, and in the process that the target object inputs a target formula based on the input area, the reference area is provided for the target object; and in response to a cursor movement operation triggered by the target object every time, presenting each candidate formula element which is supported to be input by the current cursor position in the reference region, and further presenting the selected target formula element in the input region when the target object triggers a selection operation for each candidate formula element. By providing the candidate formula elements supported and input by the current cursor position, the interference of useless formula elements on the formula editing process is reduced, so that the formula editing efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and provides a formula editing method and related apparatus. Background Technology

[0002] In document and spreadsheet software, formula editing components are specially designed tools for inputting, editing, and displaying complex mathematical formulas, chemical equations, physical formulas, and so on. For example, you can configure target formulas for columns A1 and A2 in a spreadsheet, and then calculate the sum of the data in columns A1 and A2 based on the target formulas.

[0003] In related technologies, the formula editing component presents all formula elements, such as fields and function methods. The target object can input the target formula by selecting the required formula elements.

[0004] However, the full set of formula elements contains a large number of useless formula elements, which affects the efficiency of selecting formula elements for the target object, resulting in low formula editing efficiency. Furthermore, the presentation of the full set of formula elements takes a lot of time, causing the formula editing component to lag and affecting the user experience. Summary of the Invention

[0005] This application provides a formula editing method and related apparatus to improve formula editing efficiency.

[0006] On the one hand, embodiments of this application provide a formula editing method, including:

[0007] A formula editing component is presented, which includes an input area and a reference area;

[0008] During the process of the target object inputting the target formula based on the input area, each time the cursor movement operation triggered by the target object is responded to, each candidate formula element supported by the current cursor position is presented in the reference area, and in response to the selection operation triggered by the target object for each candidate formula element, the selected target formula element is presented in the input area.

[0009] On the one hand, embodiments of this application provide a formula editing method, including:

[0010] Receive a guidance prompt request sent by the client, the guidance prompt request carrying: the formula already entered in the input area of ​​the formula editing component and the current cursor position;

[0011] At the current cursor position, the target hint element is extracted from the input formula, and each candidate formula element associated with the target hint element is used as a candidate formula element that can be input at the current cursor position.

[0012] The current cursor position supports input of each candidate formula element, so that the client can present each candidate formula element in the guide area of ​​the formula editing component, and obtain the target formula by using the target formula element selected from each candidate formula element.

[0013] On one hand, embodiments of this application provide a formula editing device, including:

[0014] A component presentation unit is used to present a formula editing component, which includes an input area and a reference area;

[0015] The formula editing unit is used to, in response to each cursor movement operation triggered by the target object during the input of a target formula based on the input area, present each candidate formula element supported by the current cursor position in the reference area, and in response to the selection operation triggered by the target object for each candidate formula element, present the selected target formula element in the input area.

[0016] In one possible implementation, the formula editing unit is also used for:

[0017] During the process of the target object inputting the target formula based on the input area, if there is a syntax error in the already input formula in the input area, an error message will be displayed to indicate the syntax error.

[0018] In one possible implementation, when presenting the error message to indicate the syntax error, the formula editing unit is specifically configured to perform at least one of the following operations:

[0019] In the input area, at least one key element in the entered formula that caused the syntax error is highlighted;

[0020] An error message describing the syntax error is displayed.

[0021] In one possible implementation, when highlighting at least one key element in the entered formula that causes the syntax error in the input area, the formula editing unit is specifically configured to perform one of the following operations:

[0022] In the input area, at least one key element is marked with an underline according to the set underline color and underline style;

[0023] In the input area, at least one key element is marked using a set highlight color;

[0024] In the input area, the at least one key element is displayed using a set font color.

[0025] In one possible implementation, when presenting candidate formula elements that the current cursor position supports input in the reference area, the formula editing unit is specifically used for:

[0026] If the current cursor position is after the dot operator, then in the reference area, each candidate formula element associated with the element preceding the dot operator is presented;

[0027] If the current cursor position is after the right parenthesis of the list function, then in the reference area, each candidate formula element associated with the operand of the list function is presented;

[0028] If the current cursor position is after the reference column, then in the reference area, each candidate formula element associated with the reference column is presented;

[0029] If the current cursor position is after the specified character, then in the reference area, each candidate formula element of the element represented by the specified character is presented.

[0030] On one hand, embodiments of this application provide a formula editing device, including:

[0031] The receiving unit is used to receive a guidance prompt request sent by the client, wherein the guidance prompt request carries: the formula already entered in the input area of ​​the formula editing component and the current cursor position;

[0032] The analysis unit extracts the target hint element from the input formula based on the current cursor position, and uses the candidate formula elements associated with the target hint element as the candidate formula elements supported by the current cursor position for input.

[0033] The sending unit returns each candidate formula element that can be input at the current cursor position, so that the client can present each candidate formula element in the guide area of ​​the formula editing component, and obtain the target formula by using the target formula element selected from each candidate formula element.

[0034] In one possible implementation, the analysis unit is also used for:

[0035] When an error analysis request is received from the client regarding the input formula, the input formula is used to perform formula calculation to obtain the calculation result.

[0036] If the calculation result indicates a calculation error, then obtain the description information for the error type setting of the calculation result. The description information is used to characterize: the position of the key element that caused the calculation error in the input formula;

[0037] Using the description information, at least one key element is extracted from the input formula, and the at least one key element is returned to the client so that the client can present error messages to indicate syntax errors based on the analysis results.

[0038] In one possible implementation, when extracting at least one key element from the input formula using the description information, the analysis unit is specifically used for:

[0039] Lexical analysis is performed on the input formula to obtain each lexical unit;

[0040] Based on the description information and the position of each lexical unit in the input formula, at least one key element is selected from each lexical unit.

[0041] In one possible implementation, when extracting the target hint element from the input formula based on the current cursor position, the analysis unit is specifically used for:

[0042] If the current cursor position in the entered formula is after the dot operator, then the element in the entered formula that is before the dot operator will be used as the target suggestion element.

[0043] If the current cursor position is after the right parenthesis of the list function in the entered formula, then the operation object of the list function in the entered formula will be used as the target prompt element.

[0044] If the current cursor position is after the referenced column in the entered formula, then the target suggestion element is: the referenced column is used as the target suggestion element;

[0045] If the current cursor position is after the specified character, then the target prompt element is the element represented by the specified character.

[0046] In one possible implementation, the analysis unit is also used for:

[0047] Perform syntax analysis on the input formula to obtain at least one function in the input formula and the nesting relationships between them;

[0048] Based on the nesting relationship, the underlying function is determined from the at least one function, and the operation object of the underlying function is used as the operation object of the list function.

[0049] On one hand, an electronic device is provided, including a processor and a memory, wherein the memory stores a computer program that, when executed by the processor, causes the processor to perform the steps of the above-described method.

[0050] On one hand, a computer-readable storage medium is provided, comprising a computer program that, when run on an electronic device, causes the electronic device to perform the steps of any of the methods described above.

[0051] On one hand, a computer program product is provided, the program product including a computer program stored in a computer-readable storage medium, wherein a processor of an electronic device reads from the computer-readable storage medium and executes the computer program, causing the electronic device to perform the steps of any of the methods described above.

[0052] In this embodiment, a formula editing component including an input area and a reference area is provided to the target object. During the process of the target object inputting the target formula based on the input area, each time a cursor movement operation triggered by the target object is responded to, the candidate formula elements that the current cursor position supports input are presented in the reference area. Then, when the target object triggers a selection operation for each candidate formula element, the selected target formula element is presented in the input area.

[0053] Compared to providing all formula elements, providing the target object with candidate formula elements that support input at the current cursor position reduces the interference of useless formula elements in the formula editing process, lowers the possibility of formula editing errors, and thus improves formula editing efficiency.

[0054] In addition, the candidate formula elements have a trigger function. When the target object triggers a selection operation on the candidate formula element, the selected target formula element will be entered into the input area. Compared with directly entering the formula element in the input area, this simplifies the formula input method and further improves the efficiency of formula editing.

[0055] Other features and advantages of this application will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the application. The objectives and other advantages of this application may be realized and obtained by means of the structures particularly pointed out in the written description, claims, and drawings. Attached Figure Description

[0056] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:

[0057] Figure 1 This is a schematic diagram illustrating the application scenario provided in the embodiments of this application;

[0058] Figure 2This is a flowchart illustrating the formula editing method on the client side provided in the embodiments of this application;

[0059] Figure 3 This is a schematic diagram of the formula editing component provided in the embodiments of this application;

[0060] Figure 4 This is a schematic diagram of the formula editing component in Case 1 provided in the embodiments of this application;

[0061] Figure 5 This is a schematic diagram of the formula editing component in Case 2 provided in the embodiments of this application;

[0062] Figure 6 This is a schematic diagram of the formula editing component in Case 3 provided in the embodiments of this application;

[0063] Figure 7 This is a schematic diagram of the formula editing component in scenario four provided in the embodiments of this application;

[0064] Figure 8 This is a schematic diagram of the formula editing component in scenario four provided in the embodiments of this application;

[0065] Figure 9 This is a schematic diagram of the formula editing component in Case 5 provided in the embodiments of this application;

[0066] Figure 10 This is a schematic diagram of the formula editing component provided in the embodiments of this application when the cursor is inside parentheses;

[0067] Figure 11A This is a schematic diagram illustrating the first type of element highlighting provided in the embodiments of this application;

[0068] Figure 11B This is a schematic diagram showing the second type of element highlighted in the embodiments of this application;

[0069] Figure 11C This is a schematic diagram illustrating the highlighting of the third element provided in the embodiments of this application;

[0070] Figure 11D This is a schematic diagram illustrating the fourth type of element highlighted in the embodiments of this application;

[0071] Figure 11E This is a schematic diagram showing the fifth element highlighted in the embodiments of this application;

[0072] Figure 11F This is a schematic diagram showing the sixth element highlighted in the embodiments of this application;

[0073] Figure 11GThis is a schematic diagram showing the seventh element highlighted in the embodiments of this application;

[0074] Figure 12 This is a schematic diagram showing the eighth element highlighted in the embodiments of this application;

[0075] Figure 13 This is a flowchart illustrating the server-side formula editing method provided in the embodiments of this application;

[0076] Figure 14 This is a flowchart illustrating the method for determining the operands of the list function provided in this application embodiment;

[0077] Figure 15 This is a flowchart illustrating the method for determining the element represented by Each in the embodiments of this application;

[0078] Figure 16 This is a schematic diagram illustrating the interaction between the client and the server during the formula editing process provided in this application embodiment;

[0079] Figure 17 This is a schematic diagram of the structure of a formula editing device provided in the embodiments of this application;

[0080] Figure 18 This is a schematic diagram of another formula editing device provided in the embodiments of this application;

[0081] Figure 19 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0082] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application. Unless otherwise specified, the embodiments and features in the embodiments of this application can be arbitrarily combined with each other. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than that shown here.

[0083] It is understood that the following specific embodiments of this application may involve obtaining user-related data such as target formulas. When the various embodiments of this application are applied to specific products or technologies, relevant licenses or consents need to be obtained, and the collection, use and processing of relevant data need to comply with the relevant laws, regulations and standards of the relevant countries and regions.

[0084] To facilitate understanding of the technical solutions provided in the embodiments of this application, some key terms used in the embodiments of this application will be explained below:

[0085] Formula editing component: also known as formula editor. In this embodiment, the formula editing component can be an editing window for editing the target formula. In addition, during the input of the target formula, the formula editing component can also be used to suggest candidate formula elements such as functions and fields that are supported for input at the current cursor position, and trigger the target formula element that is supported for input at the current cursor position through clicking or keyboard operation, so as to realize the rapid input of the target formula element.

[0086] Formula: An expression used to represent a certain relationship, rule, or calculation method. In this embodiment, the formula edited by the target object is called the target formula. The target object can use formula elements such as functions and fields to edit the target formula.

[0087] Formula column: A column type in a data table. By configuring an expression for a formula column, the data in the formula column can be automatically calculated based on the configured expression.

[0088] Reference Area: This area displays candidate formula elements, such as functions and fields, that can be entered at the current cursor position. These candidate formula elements have a triggering function; the triggered candidate formula element can be called the target formula element, which will be directly entered into the formula editing component.

[0089] Lexical unit (token): The smallest meaningful unit in a formula; multiple tokens are concatenated to form a complete formula.

[0090] Lexical analysis: This process breaks down a formula into multiple tokens of different types. For example, the formula "SUM(1)" will be broken down into the following three tokens after lexical analysis: "SUM()", "1", and ")".

[0091] Function engine: The function calculation module already present in spreadsheet software, which can perform lexical analysis and calculations on formulas.

[0092] Reference column: An element in the formula that represents a column in the referenced data table.

[0093] Sub-attributes of a column: Some types of columns have sub-attributes. For example, a geographic location column has sub-attributes such as province, city, and district.

[0094] Sub-table: A table in a table file. A table file can contain one or more sub-tables.

[0095] List functions: Functions that output lists, such as FILTER, LISTCOMBINE, UNIQUE, etc. These functions perform certain logical calculations on the input list to obtain a new list.

[0096] Each: A special field that can be used in list functions to represent each item in the list. For example, in "data table A.FILTER(Each)", Each represents each row of data table A, and in "reference column A.FILTER(Each)", Each represents the data in the reference column A. Each can also be called a specified character.

[0097] In related technologies, the formula editing component presents all formula elements, such as fields and function methods. The target object can input the target formula by selecting the required formula elements.

[0098] However, the full set of formula elements contains a large number of useless formula elements, which affects the efficiency of selecting formula elements for the target object, resulting in low formula editing efficiency. Furthermore, the presentation of the full set of formula elements takes a lot of time, causing the formula editing component to lag and affecting the user experience.

[0099] In this embodiment, a formula editing component including an input area and a reference area is provided to the target object. During the process of the target object inputting the target formula based on the input area, each time a cursor movement operation triggered by the target object is responded to, the candidate formula elements that the current cursor position supports input are presented in the reference area. Then, when the target object triggers a selection operation for each candidate formula element, the selected target formula element is presented in the input area.

[0100] Compared to providing all formula elements, providing the target object with candidate formula elements that support input at the current cursor position reduces the interference of useless formula elements in the formula editing process, lowers the probability of formula editing errors, and thus improves formula editing efficiency.

[0101] In addition, the candidate formula elements have a trigger function. When the target object triggers a selection operation on the candidate formula element, the selected target formula element will be entered into the input area. Compared with directly entering the formula element in the input area, this simplifies the formula input method and further improves the efficiency of formula editing.

[0102] The following is a brief introduction to the application scenarios to which the technical solutions of the embodiments of this application are applicable. It should be noted that the application scenarios described below are only for illustrating the embodiments of this application and are not intended to limit the scope. In specific implementation, the technical solutions provided by the embodiments of this application can be flexibly applied according to actual needs.

[0103] See Figure 1 The diagram shown is an application scenario provided by an embodiment of this application. In this scenario, a terminal device 101 and a server 102 may be included.

[0104] Terminal device 101 can be any device involving formula editing, such as mobile phone, tablet computer, laptop computer, desktop computer, smart TV, smart in-vehicle device, smart wearable device, smart TV and aircraft.

[0105] Terminal device 101 can have a client application installed that requires formula editing, such as spreadsheet software. The client can be a software client, a web page, a mini-program, etc., and there are no restrictions on the specific type of client.

[0106] Server 102 is the backend server corresponding to the client. Server 102 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms, but it is not limited to these.

[0107] In some implementations, the formula editing method in this application embodiment can be executed by the terminal device 101, i.e., by the client. For example, the terminal device 101 presents a formula editing component, which includes an input area and a reference area. During the process of the target object inputting the target formula based on the input area, each time a cursor movement operation triggered by the target object is responded to, the reference area presents each candidate formula element that the current cursor position supports input, and in response to a selection operation triggered by the target object for each candidate formula element, the input area presents the selected target formula element.

[0108] In some implementations, the candidate formula elements supported for input at the current cursor position can be determined by the server 102. For example, the server 102 receives a guidance prompt request sent by the client, which carries: the already entered formula in the input area of ​​the formula editing component and the current cursor position; based on the current cursor position, it extracts the target prompt element from the already entered formula, and uses the candidate formula elements associated with the target prompt element as the candidate formula elements supported for input at the current cursor position; it returns the candidate formula elements supported for input at the current cursor position, so that the client can display the candidate formula elements in the guidance area of ​​the formula editing component, and obtain the target formula using the target formula element selected from the candidate formula elements.

[0109] In some implementations, if the terminal device 101 has sufficient computing power, the candidate formula elements that the current cursor position supports for input can also be determined by the terminal device 101. For example, each time the terminal device 101 responds to a cursor movement operation triggered by a target object, it extracts the target hint element from the already input formulas based on the current cursor position, and uses the candidate formula elements associated with the target hint element as the candidate formula elements that the current cursor position supports for input.

[0110] Currently, specific configurations can be made according to the situation in practical applications, and this application does not impose specific limitations here. The specific formula editing process is described below and will not be repeated here.

[0111] Both server 102 and terminal device 101 may include one or more processors, memory, and interactive I / O interfaces. Furthermore, server 102 may be configured with a database for storing various formula elements. The memory of server 102 and terminal device 101 may also store the program instructions required for execution in the formula editing method provided in this embodiment, which, when executed by the processor, can be used to implement the formula editing process provided in this embodiment.

[0112] In this embodiment, the terminal device 101 and the server 102 can communicate directly or indirectly through one or more networks. This network can be a wired network or a wireless network; for example, the wireless network could be a mobile cellular network or a Wireless-Fidelity (WIFI) network, and of course, it could be other possible networks. This embodiment does not limit the types of networks used. Figure 1 The examples shown are merely illustrative; in reality, the number of terminal devices and servers is unlimited and is not specifically limited in the embodiments of this application.

[0113] In some implementations, the client can also be a standalone online spreadsheet product. The target object can edit the spreadsheet file using this online spreadsheet product. During the editing process, if the target object needs to insert a target formula, it can use the formula editing component in this embodiment to insert the target formula. Of course, the target object can also update the inserted formula using the formula editing component.

[0114] In some implementations, the client can also be an online spreadsheet product based on a personal instant messaging application, such as an online spreadsheet mini-program. The target user can edit the spreadsheet document using the online spreadsheet mini-program within the personal instant messaging application. During the editing process, if the target user needs to insert or update a target formula, they can utilize the formula editing component in this embodiment to perform the corresponding processing.

[0115] In some implementations, the client can be an online spreadsheet product based on an enterprise instant messaging application. That is, the target object can edit spreadsheet files using an online spreadsheet product within the enterprise instant messaging application. Compared to personal instant messaging applications, enterprise instant messaging applications are typically designed for internal enterprise communication, primarily for internal communication, collaboration, and management. Therefore, online spreadsheet products within enterprise instant messaging applications allow multiple objects to collaboratively edit spreadsheet documents in real time, ensuring that all objects see the latest data, avoiding version confusion and errors common in traditional spreadsheets. Furthermore, they support simultaneous editing by multiple users with real-time synchronization to ensure information synchronization. Therefore, in an online spreadsheet product based on an enterprise instant messaging application, the target object editing can be one or multiple. When multiple target objects are editing formulas, during the input of the target formula in the input area, each time the client responds to a cursor movement operation triggered by a target object, the reference area displays the candidate formula elements supported by the current cursor position to assist in selecting the target formula element. Here, a cursor movement operation triggered by a target object refers to a cursor movement operation triggered by one of the multiple target objects. In addition, the client can provide syntax error messages to each of the multiple target objects.

[0116] See Figure 2 The diagram shown is a flowchart of a formula editing method provided in this embodiment of the application. This process is applied to the client and the specific process is as follows:

[0117] S201. Present the formula editing component, which includes an input area and a reference area.

[0118] In this embodiment, the formula editing component can be a component used to input, edit, and display a target formula. The formula editing component includes an input area, a reference area, and may also include a parameter description area. The input area is used to receive and present the formula currently input by the target object, the reference area is used to present candidate formula elements, and the parameter description area is used to present descriptive information of the candidate formula elements.

[0119] In one possible implementation, the client-side includes a formula editing button to trigger the formula editing component. When the target object triggers the formula editing button, the formula editing component is displayed. Of course, in practical applications, other methods can also be used to trigger the formula editing component; this is not limited and will not be elaborated upon here.

[0120] It should be noted that in this embodiment, the formula editing component is only used as an example of an independent window. In actual application, the formula editing component can also be a component in the table interface, and is not limited to this.

[0121] For example, see Figure 3 As shown, this is a schematic diagram of the first formula editing component provided in this application embodiment. After the target object triggers the formula editing component in the spreadsheet software, the window corresponding to the formula editing component is presented in the spreadsheet interface, and this window is located above the spreadsheet interface. The formula editing component includes an input area and a reference area, wherein the input area is located in the upper area of ​​the formula editing component, and the reference area and parameter description area are located in the lower area of ​​the formula editing component. The formula entered in the input area is "datasheet1.FILTER()", and the reference area displays the formula element "Each" that can be entered at the current cursor position. In addition, the formula editing component also includes a parameter description area. When the target object selects the formula element "Each", the parameter description area displays the parameter description corresponding to the formula element "Each". The reference area also contains formula elements such as "formula 1", "person", "date", and "number", wherein "formula 1" can be a formula defined by the target object, and "person", "date", and "number" are all reference columns. It should be noted that... Figure 3 The arrangement of the input area, reference area, and parameter description area is for illustrative purposes only. In actual applications, other area arrangements can also be used, and there are no restrictions on this. Furthermore, the formula editing component can be presented in a separate window or within a table interface; there are no limitations on this.

[0122] S202. During the process of inputting the target formula based on the input area, each time the cursor movement operation triggered by the target object is responded to, the candidate formula elements supported by the current cursor position are presented in the reference area, and in response to the selection operation triggered by the target object for each candidate formula element, the selected target formula element is presented in the input area.

[0123] A formula element refers to the element that constitutes the target formula. In this article, the formula element that the current cursor position supports input is called the candidate formula element, and the candidate formula element selected by the target object is called the target formula element. Candidate formula elements include, but are not limited to, one or more of the referenced columns and functions.

[0124] In one possible implementation, the input operation of the target object in the input area causes the cursor in the input area to move. That is, the cursor in the input area moves once every time the client responds to an input operation triggered by the target object in the input area. For example, after the target object enters "Data Table 1" in the input area, the cursor is placed after "Data Table 1". If the target object then enters the dot operator in the input area, the cursor is placed after "Data Table 1.".

[0125] In one possible implementation, the target object can move the formula editor cursor using a mouse, keyboard, or other means to trigger the cursor movement operation.

[0126] In one possible implementation, the candidate formula elements supported by the current cursor position refer to the candidate formula elements associated with the target hint element. The target hint element is the formula element corresponding to the current cursor position. The process of determining the target hint element is described below and will not be repeated here.

[0127] Target hint elements include, but are not limited to: reference columns, sub-tables, the special field "Each", and the closing bracket of list functions. Considering that geolocation columns have sub-attributes, reference columns can be divided into geolocation columns and non-geographical column columns. For ease of description, non-geographical column columns will be directly referred to as reference columns below. In other words, the types of target hint elements include, but are not limited to: geolocation columns, reference columns, sub-tables, the special field "Each", and the closing bracket of list functions. See below for details on the candidate formula elements associated with different types of target hint elements.

[0128] In one possible implementation, the presentation of candidate formula elements includes, but is not limited to, the following:

[0129] Scenario 1: If the current cursor position is after the dot operator, then in the reference area, the candidate formula elements associated with the element preceding the dot operator will be displayed. The dot operator is the "." operator.

[0130] In scenario one, the formula element preceding the dot operator is used as the target suggestion element to recommend candidate formula elements. The specific candidate formula elements associated with the target suggestion element depend on its type. Typically, when the formula editor cursor is after the dot operator, the target object might be a formula in the form of "subtable.reference column" or "reference column.function," meaning the target suggestion element is usually a subtable or reference column. Therefore, candidate formula elements associated with the subtable or reference column are presented.

[0131] For example, see Figure 4As shown, the input area already contains the formula "Personnel.", and the current cursor position is after the dot operator. Therefore, the reference area displays the candidate formula elements associated with the "Personnel" column. The "Personnel" column is a reference column, so the candidate formula elements associated with the "Personnel" column include functions such as ABS, AVERAGE, CEILING, COUNT, and COUNTA. Among them, ABS is used to return the absolute value of the data, AVERAGE is used to return the average value of the data, CEILING is used to round the data up to the nearest multiple of the specified base, COUNT is used to count the number of cells containing numbers and the number of numbers in the parameter list, and COUNTA is used to count the number of non-empty cells in the range.

[0132] The dot operator is typically used to indicate access to a referenced column or a function call. The formula element preceding the dot operator is usually the data source. Therefore, using the formula element preceding the dot operator as the target hint element can quickly identify the data source and efficiently determine the methods or fields supported by that data source.

[0133] Scenario 2: If the current cursor position is after the closing parenthesis of the list function, then the candidate formula elements associated with the operands of the list function will be displayed in the reference area.

[0134] In scenario two, the operands of the list function are used as the target suggestion elements to recommend candidate formula elements. The process of determining the operands of the list function is detailed below.

[0135] Suppose that the current cursor position is after "datatable1.FILTER()", the target object may also be after "FILTER()", and the target object may also input ".SUM()". Therefore, the object operated on by the "FILTER" function is used as the object to judge the recommended option, that is, the object operated on by the "FILTER" function is used as the target suggestion element.

[0136] For example, see Figure 5 As shown, the input area already contains the formula "datatable2.FILTER()", where "datatable2" is a sub-table, "FILTER" is a list function, and the object of "FILTER" is datatable2. The current cursor position is after the closing parenthesis of "FILTER". Therefore, the reference area displays the candidate formula elements associated with datatable2, including the full function and the referenced columns from datatable2. Figure 5 In the table, "Fields of Table 2", "Single Choice", "Group Chat", "Personnel", and "Date" are all referenced columns in Table 2. Functions are not shown.

[0137] When the cursor is positioned after the closing parenthesis of a list function, considering that the target object may input other functions after the list function, regardless of whether it is another function or a list function, the actual data operated on comes from the operand of the list function. Therefore, using the operand of the list function as the judgment object for the recommended option can ensure the accuracy of the target suggestion element.

[0138] Scenario 3: If the current cursor position is after the referenced column, then the candidate formula elements associated with the referenced column will be displayed in the reference area. In Scenario 3, the referenced column is used as the target suggestion element to recommend candidate formula elements.

[0139] For example, see Figure 6 As shown, in the input area, the formula "Personnel" has been entered. The current cursor position is after "Personnel". In the reference area, the candidate formula elements associated with the "Personnel" column are presented. The candidate formula elements associated with the "Personnel" column include functions such as ABS, AVERAGE, CEILING, COUNT, and COUNTA.

[0140] For example, see Figure 7 As shown, in the input area, the formula "Geographic Location" has been entered. The current cursor position is after "Geographic Location". In the reference area, the candidate formula elements associated with the "Geographic Location" column are displayed. The candidate formula elements associated with the "Geographic Location" column include the sub-attributes of geographic location, such as province, city, district, street, and detailed address.

[0141] When the cursor is positioned after a referenced column, the target object may subsequently need to access the sub-properties or functions of that referenced column. Therefore, using the referenced column as a target hint element makes it easier for the target object to select the sub-properties or functions of the referenced column.

[0142] Case 4: If the current cursor position is after the special field "Each", then in the reference area, each candidate formula element associated with the element represented by the special field "Each" will be displayed.

[0143] In scenario four, the element represented by the special field "Each" is used as the target suggestion element to recommend candidate formula elements. Since the special field "Each" is not a specific value but represents the object operated on by the list function, it is necessary to further analyze and determine what it represents. The process of determining the element represented by the special field "Each" is detailed below.

[0144] For example, see Figure 8As shown, in the input area, the formula "DataTable2.FILTER(Each)" has already been entered. The current cursor position is after "Each". The special field "Each" represents the element "DataTable2". Therefore, in the reference area, the candidate formula elements associated with DataTable2 are displayed. These candidate formula elements include: the full function and the referenced columns in DataTable2. Figure 8 In the table, "Fields of Table 2", "Single Choice", "Group Chat", "Personnel", and "Date" are all referenced columns in Table 2. Functions are not shown.

[0145] Since the special field "Each" is not a specific value, but rather represents each item in a sub-table, referenced column, or range, when the cursor is after the special field "Each", the element represented by the special field "Each" is used as the target hint element to ensure the accuracy of the target hint element.

[0146] Case 5: Other cases besides Cases 1 to 4 mentioned above.

[0147] In one possible implementation, considering that it is difficult to determine the operation of the target object at this time, the reference columns of the current sub-table and the full functions can be displayed in the reference area for the target object to choose freely. That is, the client presents the reference columns of the current sub-table and the full functions in the reference area.

[0148] For example, see Figure 9 As shown, the formula "Data Table 2" has already been entered in the input area. The current cursor position is after "Data Table 2". "Data Table 2" is a sub-table. Therefore, the reference area displays the full function and the referenced columns from Data Table 2. Figure 8 In the table, "Fields of Table 2", "Single Choice", "Group Chat", "Personnel", and "Date" are all referenced columns in Table 2. Functions are not shown.

[0149] In one possible implementation, if the current cursor position is between the left and right parentheses of a list function, the candidate formula elements associated with the operands of the list function may include the special field "Each".

[0150] For example, see Figure 10 As shown, the input area already contains the formula "datatable1.FILTER()", where "datatable1" is a sub-table, "FILTER" is a list function, and the object of "FILTER" is datatable1. The current cursor position is between the left and right parentheses of FILTER. Therefore, the reference area displays the candidate formula elements associated with datatable1, as well as the special field "Each". The candidate formula elements associated with datatable1 include: full functions and referenced columns from datatable1. Figure 9 In the table, “Formula 1”, “Single Choice”, “Group Chat”, “Personnel”, and “Date” are all reference columns in Data Table 1, and the functions are not shown.

[0151] In some implementations, to further improve formula editing efficiency, in this embodiment, the client sorts candidate formula elements in the reference area according to their relevance to the search keyword. The search keyword can be the first token to the left of the current cursor position among all tokens included in the entered formula. The tokens included in the entered formula can be obtained through lexical analysis. The relevance can be determined based on the text similarity between the search keyword and the candidate formula elements; text similarity can be calculated using, but is not limited to, cosine similarity.

[0152] For example, if the formula "datatable1.S" has been entered and the cursor is located after the character "S", then S is the search keyword. The candidate formula elements supported by the current cursor position are the full function and the referenced columns in datatable1. Therefore, the text similarity between the full function and the referenced columns in datatable1 and the character "S" is determined. Then, the full function and the referenced columns in datatable1 are sorted in descending order of text similarity, and the full function and the referenced columns in datatable1 are presented according to the sorting results.

[0153] By sorting the candidate formula elements according to their degree of relevance, it is easier for the target audience to select elements, thereby improving the product user experience.

[0154] In some implementations, formulas typically have a relatively fixed syntax format. If the target object selects the wrong field or function method, it needs to reselect the correct field or function method until the correct formula content is entered. Continuous trial and error will seriously affect the efficiency of formula editing, thereby reducing the user experience. In this embodiment, an error prompting method is also provided. Specifically, during the process of the target object entering the target formula based on the input area, if there is a syntax error in the already entered formula in the input area, an error prompt message for indicating the syntax error is presented.

[0155] Error messages may be displayed in at least one of the following ways, but are not limited to:

[0156] Method 1: In the input area, highlight at least one key element in the entered formula that is causing a syntax error. By highlighting key elements, the target audience can quickly and directly identify the key element causing the syntax error, making it easier for them to adjust the key element subsequently, thereby improving the product's usability.

[0157] In one possible implementation, highlighting can be achieved in, but is not limited to, the following ways:

[0158] Tip 1-1: In the input area, underline at least one key element according to the set underline color and style.

[0159] The underline color and style can be set by the target object or by the system default; there are no restrictions on this.

[0160] See Figure 11A As shown, the formula "1 / 0" has been entered, the key element is "0", the underline color is red, and the underline style is a wavy line. Therefore, a red wavy underline is used to mark "0".

[0161] See Figure 11B As shown, the formula "TEST()" has been entered, the key element is "TEST", the underline color is red, and the underline style is a wavy line. Therefore, a red wavy underline is used to mark "TEST".

[0162] See Figure 11C As shown, the formula "SUM(aaaaa)" has been entered, the key element is "aaaaa", the underline color is red, and the underline style is a wavy line. Therefore, a red wavy underline is used to mark "aaaaa".

[0163] See Figure 11D As shown, the formula "FALSE (single selection)" has been entered, the key element is "single selection", the underline color is red, and the underline style is a wavy line. Therefore, a red wavy underline is used to mark "single selection".

[0164] See Figure 11E As shown, the formula has been entered as "single selection". The key element is quotation marks, the underline color is red, and the underline style is wavy. Therefore, a red wavy underline is used to mark the quotation marks.

[0165] See Figure 11F As shown, the formula (i.e., formula 1) has been entered as "SUM(formula)", the key element is "formula", the underline color is red, and the underline style is a wavy line. Therefore, a red wavy underline is used to mark "formula".

[0166] See Figure 11G As shown, the formula has been entered as "[AAA]", the key element is "[AAA]", AAA is a missing reference column, the underline color is red, and the underline style is a wavy line. Therefore, a red wavy underline is used to mark "[AAA]".

[0167] Prompt Method 1-2: In the input area, mark at least one key element using the set highlight color.

[0168] The highlight color can be set by the target object or by the system default; there is no limitation on this.

[0169] For example, if the formula is "1 / 0" and the key element is "0", the key element "0" will be highlighted in yellow.

[0170] Tip 1-3: In the input area, display at least one key element using the set font color.

[0171] The font color can be set by the target object or by the system default; there are no restrictions. For easy distinction, the font color of key elements will be different from the font color of other elements in the entered formula.

[0172] For example, if the formula is "1 / 0" and the key element is "0", the font color of the key element "0" in the entered formula will be red in the input area, and the other elements in the entered formula other than the key element "0" will be black.

[0173] Tip 1-3: In the input area, display at least one key element using the set font color.

[0174] Method 2: Display error message text describing syntax errors.

[0175] Error message text can be displayed in the parameter description area of ​​the formula editing component, in the input area, or in the reference area. Of course, it can also be displayed in a separate pop-up window or other ways, without any restrictions.

[0176] Error message text may include one or more of the following: error type, suggested corrections, etc.

[0177] In one possible implementation, the input area can be further divided into an input sub-region, a result sub-region, and a description sub-region. The input sub-region is used to receive the target formula input, the result sub-region is used to present the calculation results and error types, and the description sub-region is used to present error correction suggestions.

[0178] See Figure 11A As shown, in the input area, error message text is displayed. The error message text includes: error type "division by 0", error correction suggestion "division by 0 is not allowed".

[0179] See Figure 11BAs shown, in the input area, error message text is displayed. The error message text includes: error type "unrecognized content", and error correction suggestion "TEST function is not in the list of supported functions".

[0180] See Figure 11C As shown, the input area displays error message text, including: error type "unrecognized content", and error correction suggestion "data table or field not found".

[0181] See Figure 11D As shown, the input area displays error message text, which includes: error type "formula error", error correction suggestion "the number of parameters in FALSE is incorrect. There should be 0 parameters, but there is actually 1".

[0182] See Figure 11E As shown, the input area displays error message text, which includes: error type "Unrecognized content", and error correction suggestion "Quote marks cannot be recognized, please delete extra quote marks".

[0183] See Figure 11F As shown, the input area displays an error message, which includes: Error type is "circular reference", and the suggested correction is: There is a circular reference between the formula field "Formula 1" and the formula field "Formula". Please modify the formula.

[0184] See Figure 11G As shown, the input area displays error message text, including: error type "content deleted", and error correction suggestion "field has been deleted, please select again".

[0185] In this embodiment of the application, the above-mentioned prompting method one and prompting method two can be used individually or in combination.

[0186] In some implementations, to facilitate formula input, the client can also display the function format of the currently input function while the target object is inputting the target formula. The area where the function format is displayed is not limited; for example, the function format can be displayed in the input area.

[0187] In some implementations, to facilitate error correction for the target user, if a formula already entered in the input area contains a syntax error, the client can highlight the format parameters corresponding to the key elements in the function format of the key function, as well as the key elements in the entered formula. Here, the key function refers to the function that has a syntax error. Besides highlighting, other methods can also be used for highlighting.

[0188] For example, see Figure 12As shown, the entered formula is "SUM()". The function format of SUM is: SUM(value1, [value2], ...), meaning that the SUM function requires parameters. However, the entered formula does not contain parameters. Therefore, the double brackets in the entered formula and the first parameter in the SUM function format are highlighted. It should be noted that the function format hints and the key element hints mentioned above (hint method one and hint method two) can be performed simultaneously.

[0189] In this way, in the event of an error, the target object can quickly adjust the formula according to the correct function format of the key function, thereby improving the user experience of the product.

[0190] See Figure 13 The diagram shown is a flowchart of a formula editing method provided in this embodiment of the application. This method is applied to the server side, and the specific process is as follows:

[0191] S1301. Receive a guidance prompt request sent by the client. The guidance prompt request carries: the formula already entered in the input area of ​​the formula editing component and the current cursor position.

[0192] In one possible implementation, each time the target object triggers a cursor movement operation, the client sends a prompt request to the server, which carries the formulas already entered in the input area and the current cursor position.

[0193] S1302. Based on the current cursor position, extract the target hint element from the input formula, and use the candidate formula elements associated with the target hint element as the candidate formula elements supported by the current cursor position for input.

[0194] The types of target hint elements include, but are not limited to: geographic location column, reference column, sub-table, special field "Each", and list function right bracket.

[0195] In one possible implementation, if the current cursor position is after the dot operator in the formula, the element in the formula before the dot operator is used as the target suggestion element. If the current cursor position is after the closing parenthesis of a list function, the operand of the list function in the formula is used as the target suggestion element. If the current cursor position is after a referenced column, the referenced column is used as the target suggestion element. If the current cursor position is after the special field "Each", the element represented by the special field "Each" is used as the target suggestion element. In addition to the above, the candidate formula elements associated with the full function and the referenced columns in the current subtable can be used as the target suggestion element. Furthermore, if the current cursor position is within the parentheses of a list function, the special field "Each" is also used as an associated candidate formula element.

[0196] The following section explains the candidate formulas associated with different types of target prompt elements.

[0197] (1) Geographic Location Column. The target hint element associated with the geographic location column is a sub-attribute of the geographic location column. The sub-attributes of the geographic location column include, but are not limited to: province, city, district, street, etc.

[0198] (2) Reference column. If the reference column is after the dot operator, the target hint element associated with the reference column includes: full function; otherwise, the target hint element associated with the reference column includes: full function and reference column in the current subtable, and if the current cursor position is inside the parentheses of a list function, the target hint element associated with the reference column also includes: the special field "Each".

[0199] (3) Sub-table. The target hint elements associated with the sub-table include: the full function and the referenced columns in the sub-table. If the current cursor position is within the parentheses of a list function, the target hint elements associated with the sub-table also include: the special field "Each".

[0200] (4) Special field “Each”. Get the element represented by the special field “Each” and use the element represented by the special field “Each” as the target prompt element.

[0201] (5) The closing bracket of a list function. This retrieves the operand of the list function and uses it as the target prompt element.

[0202] In one possible implementation, the operands of the list function can be determined in the following way:

[0203] First, perform syntax analysis on the entered formula to obtain at least one function in the entered formula and the nesting relationship between them; second, based on the nesting relationship, determine the underlying function from at least one function, and use the operation object of the underlying function as the operation object of the list function.

[0204] For example, see Figure 14 As shown, the operands of list functions can be determined through the following steps:

[0205] S1401. Starting from the current cursor position, obtain the first pair of matching parentheses in the current formula from right to left. The first pair of matching parentheses includes: left parenthesis i and right parenthesis j. The initial value of the current formula is the already entered formula.

[0206] S1402. Obtain the detection function based on the character to the left of the left parenthesis i.

[0207] S1403. Determine if a dot operator exists before the detection function. If yes, execute S1404a; otherwise, execute S1404b.

[0208] S1404a. Take the first element to the left of the dot operator as the element to be detected.

[0209] S1404b: The characters between the left parenthesis i and the first comma to its right are taken as the elements to be detected.

[0210] S1405. Determine whether the element to be detected is a single element. If yes, execute S1406; otherwise, execute S1409. A single element refers to a reference column, sub-table, or sub-attribute, etc.

[0211] S1406, determine whether the element to be detected is Each. If yes, execute S1408; otherwise, execute S1407.

[0212] S1407. The element to be detected is the operand of the list function.

[0213] S1408. Use the elements represented by Each as the operands of the list function.

[0214] S1409: The characters from the beginning of the current formula to the right parenthesis j will be used as the next formula.

[0215] Taking the FILTER function as an example, the FILTER function can be used in two syntax formats: "datatableA.FILTER()" and "FILTER(datatableA)". If the formula is "datatableA.FILTER()", the function to be checked is FILTER. Since there is a dot operator before FILTER, the first element to the left of the dot operator, "datatableA", is taken as the element to be checked. And since "datatableA" is a single element, it is used as the operand of the list function, where FILTER is the underlying function. If the formula is "FILTER(datatableA)", the function to be checked is FILTER. Since there is no dot operator before FILTER, the characters between the left parenthesis and the first comma to the right, "datatableA", are taken as the element to be checked. Since "datatableA" is a single element, it is used as the operand of the list function, where FILTER is the underlying function.

[0216] For example, suppose the entered formula is formatted as "FILTER(SORT(data_tableA.data_range), filter_condition)", where FILTER is the outer function and SORT is the inner function. First, FILTER is used as the detection function. Since there is no dot operator before FILTER, the characters "SORT(data_tableA.data_range)" between the left parenthesis and the first comma on the right are used as the element to be detected. Because "SORT(data_tableA.data_range)" is not a single element, it is used as the next formula. Next, for the current formula "SORT(data_tableA.data_range)", the detection function is SORT. Since there is no dot operator before SORT, the characters "data_tableA.data_range" between the left parenthesis and the first comma on the right are used as the element to be detected. Because "data_tableA.data_range" is a single element, it is used as the object of the list function.

[0217] In the above implementation method, regardless of the syntax format used by the target object to input the formula, the underlying function can be extracted to determine the operation object of the list function, thereby ensuring the accuracy of the extracted formula and improving the accuracy of the prompt.

[0218] For example, see Figure 15 As shown, the elements represented by Each can be determined through the following steps:

[0219] S1501. Starting from the current cursor position, obtain the first left parenthesis in the current formula from right to left. The first left parenthesis is denoted as left parenthesis i.

[0220] S1502. Obtain the detection function based on the character to the left of the left parenthesis i.

[0221] S1503. Determine if a dot operator exists before the detection function. If yes, execute S1504a; otherwise, execute S1504b.

[0222] S1504a. Take the first element to the left of the dot operator as the element to be detected.

[0223] S1504b: The characters between the left parenthesis i and the first comma to its right are taken as the elements to be detected.

[0224] S1505. Determine whether the element to be detected is a single element. If yes, execute S1506; otherwise, execute S1509. A single element refers to a reference column, sub-table, or sub-attribute, etc.

[0225] S1506, determine whether the element to be detected is Each. If yes, execute S1508; otherwise, execute S1507.

[0226] S1507. Treat the element to be detected as an element represented by Each.

[0227] S1508. Adjust the current cursor position to the position of Each, and execute S1501.

[0228] S1509: The characters from the beginning of the current formula to the right parenthesis are taken as the formula to be tested, and the operands of the list functions in the formula to be tested are taken as the elements to be tested. Then S1506 is executed.

[0229] For example, suppose the formula is "data table A.FILTER(Each)" and the detection function is FILTER. Since there is a dot operator before FILTER, the first element to the left of the dot operator, "data table A", is taken as the element to be detected. Also, "data table A" is a single element and not Each, so "data table A" is taken as the element represented by Each.

[0230] S1303. Return to the candidate formula elements that the current cursor position supports input, so that the client can display the candidate formula elements in the guide area of ​​the formula editing component, and obtain the target formula by using the target formula element selected from the candidate formula elements.

[0231] In some implementations, when the server receives an error analysis request from the client for an entered formula, it can also perform formula calculations using the entered formula to obtain the calculation result. If the calculation result indicates a calculation error, it can obtain descriptive information set for the error type of the calculation result. The descriptive information is used to characterize the position of the key element that caused the calculation error in the entered formula. Then, using the descriptive information, it can extract at least one key element from the entered formula and return at least one key element to the client, so that the client can present error message to indicate syntax errors based on the analysis result.

[0232] In one possible implementation, when the server receives a bootstrap request, it determines that it has received an error analysis request; that is, the bootstrap request can be regarded as an error analysis request.

[0233] In one possible implementation, whenever the target object triggers an input operation in the input area of ​​the formula editing component, the client sends an error analysis request to the server for the entered formula.

[0234] In one possible implementation, the error analysis request carries the formula that the target object has currently entered in the input area. In this way, when the server receives the error analysis request, it uses the formula that has been entered in the error analysis request to perform formula calculation and obtain the calculation result.

[0235] In one possible implementation, the calculation result is used to indicate whether the calculation was successful. If the calculation result is an error, it may also include the error type. Error types include, but are not limited to: division by zero, unknown field name, unknown function name, too many parameters, too few parameters, circular reference, field enclosed in double quotes, field lacking permissions, or field being deleted.

[0236] In this embodiment of the application, corresponding descriptive information can be pre-set for each type of error. The descriptive information corresponding to each type of error is described below.

[0237] (1) Division by zero. If the error type is division by zero, then the description information is: In the formula, the number “0” after the division sign token is the key element.

[0238] (2) Unknown field name. If the error type is unknown field name, then the description information is: the key element is the token of the unknown field name that is reported in the formula, which is a variable of type token and whose content is the token of the unknown field name that is reported in the error.

[0239] (3) Unknown function name. If the error type is unknown function name, then the description information indicates that the key element is the token of type function in the entered formula, and the token content is the unknown function name of the error.

[0240] (4) Incorrect parameter quantity. Incorrect parameter quantity can be divided into two situations: too many parameters and too few parameters.

[0241] (4-1) Too many parameters. Description: The key element is the extra tokens between the left and right parentheses of the list function in the input formula. Extra tokens are those that exceed the number of parameters required by the list function. For example, extra tokens can be the last N tokens between the left and right parentheses of the list function, where N is the actual number of parameters minus the number of parameters required by the list function.

[0242] (4-2) Insufficient parameters. Description information representation: In the formula, the tokens between the left and right parentheses of the list function are all key elements.

[0243] (5) Circular reference. If the error type is circular reference, then the description information indicates that the key element is the token that is a variable of type token and whose content is the name of the field that caused the error.

[0244] (6) Fields are enclosed in double quotes. If the error type is "fields are enclosed in double quotes", then the description information indicates: In the entered formula, the variable token between the two consecutive double quotes "t" is a key element.

[0245] (7) Field has no permission or has been deleted. If the error type is field has no permission or has been deleted, then the description information indicates that: in the formula, the token type is a variable and the token content is the token of the field with the error.

[0246] In one possible implementation, lexical analysis can be performed on the input formula to obtain each lexical unit; based on the description information and the position of each lexical unit in the input formula, at least one key element can be selected from each lexical unit.

[0247] In this article, the syntax analysis of the input formula can obtain each token contained in the input formula. Then, based on the description information corresponding to the error type, the target token is selected from each token. The target token is the key element.

[0248] In one possible implementation, each token can be presented as a list of tokens, but this is not a limitation.

[0249] For example, if the entered formula is "1 / 0" and the error type is division by zero, the token list for the entered formula "1 / 0" is {"1", " / ", "0"}. Based on the description information corresponding to the error type "division by zero", first find the division sign token in the entered formula. The token after the division sign token is the number "0" token. Therefore, the number "0" token is the target token.

[0250] For example, if the formula "SUM(aaa)" has been entered, the error type is unknown field name, the unknown field name is "aaa", and the token list for the entered formula "SUM(aaa)" is {"SUM()", "aaa", ")"}, then based on the description information corresponding to the error type "unknown field name", the token "aaa", which is a variable and whose content is the unknown field name that caused the error, is used as the target token.

[0251] For example, if the formula "TEST()" has been entered, the error type is "unknown function name", the unknown function name is "TEST", and the token list for the entered formula "TEST()" is {"TEST()", ")"}, then based on the description information corresponding to the error type "unknown function name", the "TEST()" token, which is a variable and contains the name of the unknown function that caused the error, is used as the target token.

[0252] For example, if the formula "FALSE(A1)" has been entered, and the error type is "too many parameters", the FALSE function should have 0 parameters, but it actually has 1. The token list for the entered formula "FALSE(A1)" is {"TEST()", "A1", ")"}. Based on the description information corresponding to the error type "too many parameters", the "A1" token will be used as the target token.

[0253] For example, if the formula "SUM(a)" has been entered, and the error type is "too few parameters", the SUM function should have at least 2 parameters, but it actually has 1. The token list for the entered formula "SUM(a)" is {"SUM()", "a", ")"}. Based on the description information corresponding to the error type "too few parameters", the token "a" will be used as the target token.

[0254] In the above implementation, the formula is analyzed by lexical units obtained through lexical analysis. This allows for the screening of elements at a finer granular level, thereby accurately locating key elements and improving the accuracy of error analysis.

[0255] The present application will now be described with reference to a specific embodiment.

[0256] See Figure 16 As shown, a spreadsheet app is installed on the phone, and the target object triggers the formula editing component within the spreadsheet app. Assume the target object needs to input the formula "DataTable3.FILTER(Each)".

[0257] First, the target user enters "Data Table 3" in the input area of ​​the formula editing component. With the cursor positioned after "Data Table 3", the phone sends a reference suggestion request to the server. This request carries the entered formula "Data Table 3" and the current cursor position. Based on these information, the server determines the candidate formula elements corresponding to the current cursor position, including the reference columns and full functions in Data Table 3, and returns these elements to the phone. The phone then displays these candidate formula elements in the application area of ​​the formula editing component. Furthermore, the server can perform error analysis on the entered formula "Data Table 3" and return the corresponding key elements if calculation errors are found.

[0258] Next, the target user enters a dot operator "." in the input area of ​​the formula editing component. The cursor position is after the dot operator. The phone sends a reference suggestion request to the server, carrying the entered formula "Data Table 3." and the current cursor position. Based on the entered formula "Data Table 3." and the current cursor position, the server determines the candidate formula elements corresponding to the current cursor position, including the reference columns and full functions in Data Table 3, and returns these candidate formula elements to the phone. The phone then displays these candidate formula elements corresponding to the current cursor position in the application area of ​​the formula editing component. The server can also perform error analysis on the entered formula "Data Table 3." and return the corresponding key elements if calculation errors are found.

[0259] Next, the "FILTER function" is selected from the functions in the target object reference area to input the FILTER function. At this time, the entered formula in the input area is "DataTable3.FILTER()", and the current cursor position is between the left and right parentheses of the FILTER function. The mobile phone sends a reference hint request to the server, which carries the entered formula "DataTable3.FILTER()" and the current cursor position. Based on the entered formula "DataTable3.FILTER()" and the current cursor position, the server determines the candidate formula elements corresponding to the current cursor position, including: each reference column in DataTable3, the full function, and the special field "Each", and returns each candidate formula element to the mobile phone. The mobile phone displays each candidate formula element corresponding to the current cursor position in the application area of ​​the formula editing component. The server can also perform error analysis on the entered formula "DataTable3.FILTER()" and return the corresponding key elements when there are calculation errors.

[0260] Next, select the special field "Each" in the function of the target object reference area to realize the input of the special field "Each". At this time, the formula already entered in the input area is "Data Table 3.FILTER(Each)", which realizes the input of the target formula.

[0261] Based on the same inventive concept, embodiments of this application provide a formula editing device. For example... Figure 17 As shown, this is a structural schematic diagram of the formula editing device 1700, which may include:

[0262] The component presentation unit 1701 is used to present a formula editing component, which includes an input area and a reference area;

[0263] The formula editing unit 1702 is used to, in response to each cursor movement operation triggered by the target object during the input of a target formula based on the input area, present each candidate formula element supported by the current cursor position in the reference area, and in response to the selection operation triggered by the target object for each candidate formula element, present the selected target formula element in the input area.

[0264] In one possible implementation, the formula editing unit 1702 is also used for:

[0265] During the process of the target object inputting the target formula based on the input area, if there is a syntax error in the already input formula in the input area, an error message will be displayed to indicate the syntax error.

[0266] In one possible implementation, when presenting the error message indicating the syntax error, the formula editing unit 1702 is specifically configured to perform at least one of the following operations:

[0267] In the input area, at least one key element in the entered formula that caused the syntax error is highlighted;

[0268] An error message describing the syntax error is displayed.

[0269] In one possible implementation, when highlighting at least one key element in the entered formula that causes the syntax error in the input area, the formula editing unit 1702 is specifically configured to perform one of the following operations:

[0270] In the input area, at least one key element is marked with an underline according to the set underline color and underline style;

[0271] In the input area, at least one key element is marked using a set highlight color;

[0272] In the input area, the at least one key element is displayed using a set font color.

[0273] In one possible implementation, when presenting candidate formula elements that the current cursor position supports input in the reference area, the formula editing unit 1702 is specifically used for:

[0274] If the current cursor position is after the dot operator, then in the reference area, each candidate formula element associated with the element preceding the dot operator is presented;

[0275] If the current cursor position is after the right parenthesis of the list function, then in the reference area, each candidate formula element associated with the operand of the list function is presented;

[0276] If the current cursor position is after the reference column, then in the reference area, each candidate formula element associated with the reference column is presented;

[0277] If the current cursor position is after the specified character, then in the reference area, each candidate formula element of the element represented by the specified character is presented.

[0278] Based on the same inventive concept, embodiments of this application provide a formula editing device. For example... Figure 18 As shown, this is a structural schematic diagram of the formula editing device 1800, which may include:

[0279] The receiving unit 1801 is used to receive a guidance prompt request sent by the client, wherein the guidance prompt request carries: the input formula in the input area of ​​the formula editing component and the current cursor position;

[0280] Analysis unit 1802 extracts target prompt elements from the input formulas based on the current cursor position, and uses each candidate formula element associated with the target prompt element as a candidate formula element supported by the current cursor position for input.

[0281] The sending unit 1803 returns each candidate formula element that can be input at the current cursor position, so that the client can present each candidate formula element in the guide area of ​​the formula editing component, and obtain the target formula by using the target formula element selected from each candidate formula element.

[0282] In one possible implementation, the analysis unit 1802 is further used for:

[0283] When an error analysis request is received from the client regarding the input formula, the input formula is used to perform formula calculation to obtain the calculation result.

[0284] If the calculation result indicates a calculation error, then obtain the description information for the error type setting of the calculation result. The description information is used to characterize: the position of the key element that caused the calculation error in the input formula;

[0285] Using the description information, at least one key element is extracted from the input formula, and the at least one key element is returned to the client so that the client can present error messages to indicate syntax errors based on the analysis results.

[0286] In one possible implementation, when extracting at least one key element from the input formula using the description information, the analysis unit 1802 is specifically used for:

[0287] Lexical analysis is performed on the input formula to obtain each lexical unit;

[0288] Based on the description information and the position of each lexical unit in the input formula, at least one key element is selected from each lexical unit.

[0289] In one possible implementation, when extracting the target hint element from the input formula based on the current cursor position, the analysis unit 1802 is specifically used for:

[0290] If the current cursor position in the entered formula is after the dot operator, then the element in the entered formula that is before the dot operator will be used as the target suggestion element.

[0291] If the current cursor position is after the right parenthesis of the list function in the entered formula, then the operation object of the list function in the entered formula will be used as the target prompt element.

[0292] If the current cursor position is after the referenced column in the entered formula, then the target suggestion element is: the referenced column is used as the target suggestion element;

[0293] If the current cursor position is after the specified character, then the target prompt element is the element represented by the specified character.

[0294] In one possible implementation, the analysis unit 1802 is further used for:

[0295] Perform syntax analysis on the input formula to obtain at least one function in the input formula and the nesting relationships between them;

[0296] Based on the nesting relationship, the underlying function is determined from the at least one function, and the operation object of the underlying function is used as the operation object of the list function.

[0297] For ease of description, the above sections are divided into modules (or units) according to their functions and described separately. Of course, in implementing this application, the functions of each module (or unit) can be implemented in one or more software or hardware components.

[0298] Regarding the apparatus in the above embodiments, the specific manner in which each unit executes the request has been described in detail in the embodiments related to the method, and will not be elaborated here.

[0299] Those skilled in the art will understand that various aspects of this application can be implemented as a system, method, or program product. Therefore, various aspects of this application can be specifically implemented in the following forms: a completely hardware implementation, a completely software implementation (including firmware, microcode, etc.), or a combination of hardware and software implementations, collectively referred to herein as a "circuit," "module," or "system."

[0300] Based on the same inventive concept, embodiments of this application also provide an electronic device. In one embodiment, the electronic device can be a server or a terminal device. See also... Figure 19 As shown, it is a schematic diagram of the structure of a possible electronic device provided in an embodiment of this application. Figure 19 In the electronic device 1900, there are: processor 1910 and memory 1920.

[0301] The memory 1920 stores a computer program that can be executed by the processor 1910. By executing the instructions stored in the memory 1920, the processor 1910 can perform the steps of the above formula editing method.

[0302] Memory 1920 may be volatile memory, such as random-access memory (RAM); memory 1920 may also be non-volatile memory, such as read-only memory (ROM), flash memory, hard disk drive (HDD), or solid-state drive (SSD); or memory 1920 may be any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer, but is not limited thereto. Memory 1920 may also be a combination of the above-mentioned memories.

[0303] Processor 1910 may include one or more central processing units (CPUs) or digital processing units, etc. Processor 1910 implements the above-described formula editing method when executing computer programs stored in memory 1920.

[0304] In some embodiments, the processor 1910 and the memory 1920 may be implemented on the same chip, while in other embodiments they may be implemented on separate chips.

[0305] This application embodiment does not limit the specific connection medium between the processor 1910 and the memory 1920. This application embodiment takes the connection between the processor 1910 and the memory 1920 via a bus as an example. Figure 19 The diagram uses thick lines to describe the connections between other components; these are merely illustrative and not intended to be limiting. Buses can be categorized as address buses, data buses, control buses, etc. For ease of description, Figure 19 It is described using only a thick line, but does not indicate that there is only one bus or one type of bus.

[0306] Based on the same inventive concept, embodiments of this application provide a computer-readable storage medium including a computer program. When the computer program is run on an electronic device, it causes the electronic device to perform the steps of the above-described formula editing method. In some possible implementations, various aspects of the formula editing method provided in this application can also be implemented as a program product including a computer program. When the program product is run on an electronic device, the computer program causes the electronic device to perform the steps in the above-described formula editing method. For example, the electronic device can perform actions such as... Figure 2 The steps are shown in the figure.

[0307] The program product may employ any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: electrical connections having one or more wires, portable disks, hard disks, RAM, ROM, erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0308] The program product of the embodiments of this application may be a CD-ROM and include a computer program, and may run on an electronic device. However, the program product of this application is not limited thereto. In this document, the readable storage medium may be any tangible medium that contains or stores a computer program that may be used by or in conjunction with a command execution system, apparatus, or device.

[0309] A readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying a readable computer program. This propagated data signal may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium, capable of sending, propagating, or transmitting a computer program for use by or in conjunction with a command execution system, apparatus, or device.

[0310] Although preferred embodiments of this application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of this application.

[0311] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.

Claims

1. A formula editing method, characterized in that, include: A formula editing component is presented, which includes an input area and a reference area; During the process of the target object inputting the target formula based on the input area, each time the cursor movement operation triggered by the target object is responded to, each candidate formula element supported by the current cursor position is presented in the reference area, and in response to the selection operation triggered by the target object for each candidate formula element, the selected target formula element is presented in the input area.

2. The method as described in claim 1, characterized in that, Also includes: During the process of the target object inputting the target formula based on the input area, if there is a syntax error in the input formula, an error message will be displayed to indicate the syntax error.

3. The method as described in claim 2, characterized in that, The presentation of error message information to indicate the syntax error includes at least one of the following operations: In the input area, at least one key element in the entered formula that caused the syntax error is highlighted; An error message describing the syntax error is displayed.

4. The method as described in claim 3, characterized in that, In the input area, highlighting at least one key element in the entered formula that caused the syntax error includes an operation: In the input area, at least one key element is marked with an underline according to the set underline color and underline style; In the input area, at least one key element is marked using a set highlight color; In the input area, the at least one key element is displayed using a set font color.

5. The method according to any one of claims 1-4, characterized in that, The reference area displays the candidate formula elements that can be entered at the current cursor position, including: If the current cursor position is after the dot operator, then in the reference area, each candidate formula element associated with the element preceding the dot operator is presented; If the current cursor position is after the right parenthesis of the list function, then in the reference area, each candidate formula element associated with the operand of the list function is presented; If the current cursor position is after the reference column, then in the reference area, each candidate formula element associated with the reference column is presented; If the current cursor position is after the specified character, then in the reference area, each candidate formula element of the element represented by the specified character is presented.

6. A formula editing method, characterized in that, include: Receive a guidance prompt request sent by the client, the guidance prompt request carrying: the formula already entered in the input area of ​​the formula editing component and the current cursor position; Based on the current cursor position, extract the target hint element from the input formula, and use each candidate formula element associated with the target hint element as the candidate formula elements supported by the current cursor position for input. Return to the candidate formula elements that can be input at the current cursor position, so that the client can display the candidate formula elements in the guide area of ​​the formula editing component, and obtain the target formula by using the target formula element selected from the candidate formula elements.

7. The method as described in claim 6, characterized in that, Also includes: When an error analysis request is received from the client regarding the input formula, the input formula is used to perform formula calculation to obtain the calculation result. If the calculation result indicates a calculation error, then obtain the description information for the error type setting of the calculation result. The description information is used to characterize: the position of the key element that caused the calculation error in the input formula; Using the description information, at least one key element is extracted from the input formula, and the at least one key element is returned to the client so that the client can present error messages to indicate syntax errors based on the analysis results.

8. The method as described in claim 7, characterized in that, The step of extracting at least one key element from the input formula using the descriptive information includes: Lexical analysis is performed on the input formula to obtain each lexical unit; Based on the description information and the position of each lexical unit in the input formula, at least one key element is selected from each lexical unit.

9. The method as described in claim 6, 7, or 8, characterized in that, The step of extracting the target hint element from the entered formula based on the current cursor position includes: If the current cursor position in the entered formula is after the dot operator, then the element in the entered formula that is before the dot operator will be used as the target suggestion element. If the current cursor position is after the right parenthesis of the list function in the entered formula, then the operation object of the list function in the entered formula will be used as the target prompt element. If the current cursor position is after the referenced column in the entered formula, then the target suggestion element is: the referenced column is used as the target suggestion element; If the current cursor position is after the specified character, then the target prompt element is the element represented by the specified character.

10. The method as described in claim 9, characterized in that, The operands of the list function are determined in the following way: Perform syntax analysis on the input formula to obtain at least one function in the input formula and the nesting relationships between them; Based on the nesting relationship, the underlying function is determined from the at least one function, and the operation object of the underlying function is used as the operation object of the list function.

11. A formula editing device, characterized in that, include: A component presentation unit is used to present a formula editing component, which includes an input area and a reference area; The formula editing unit is used to, in response to each cursor movement operation triggered by the target object during the input of a target formula based on the input area, present each candidate formula element supported by the current cursor position in the reference area, and in response to the selection operation triggered by the target object for each candidate formula element, present the selected target formula element in the input area.

12. A formula editing device, characterized in that, include: The receiving unit is used to receive a guidance prompt request sent by the client, wherein the guidance prompt request carries: the formula already entered in the input area of ​​the formula editing component and the current cursor position; The analysis unit extracts the target hint element from the input formula based on the current cursor position, and uses the candidate formula elements associated with the target hint element as the candidate formula elements supported by the current cursor position for input. The sending unit returns each candidate formula element that can be input at the current cursor position, so that the client can present each candidate formula element in the guide area of ​​the formula editing component, and obtain the target formula by using the target formula element selected from each candidate formula element.

13. An electronic device, characterized in that, It includes a processor and a memory, wherein the memory stores a computer program that, when executed by the processor, causes the processor to perform the steps of any of the methods of claims 1 to 5, or to perform the steps of any of the methods of claims 6 to 10.

14. A computer-readable storage medium, characterized in that, It includes a computer program that, when run on an electronic device, causes the electronic device to perform the steps of any of the methods described in claims 1 to 5, or to perform the steps of any of the methods described in claims 6 to 10.

15. A computer program product, characterized in that, It includes a computer program stored in a computer-readable storage medium, and a processor of an electronic device reads from and executes the computer program, causing the electronic device to perform the steps of any of the methods of claims 1 to 5, or to perform the steps of any of the methods of claims 6 to 10.