Quickly implement database tree structure in PB

zhaozj2021-02-17  78

Quickly implement database tree structure in PB

(Author: Ruan Xiaohua, 2001 at 17:23 on April 3)

The tree structure is universal in the Windows environment, which is popular with users with a simple interface. However, in the development of database development, how to construct the tree directory quickly in the development of data in database development? Implementing Key Technologies contains TreeView controls in the controls provided by PowerBuilder, but the specific formation of the tree requires the user to write script implementations, that is, its list item is dynamically added in the program, and these list data is usually entered by the user in the database. Among them, as a content for database maintenance. In order to quickly implement the tree structure of the database, we can use the encoding method to achieve the encoding table. The basic fields of the encoding table include encoding and encoding names. The coding rules are distinguished by numbers, the number of letters, the same layer, the number of encoding bits is the same, the hierarchical bit bit number is incremented, and the program determines the layer by judging the number of encoding bits. number. For example, the first layer is 10 to 99, the second layer is 1010 to 1099, and the user needs to do the structure and corresponding encoding of the tree, and enters the corresponding name, and then the program is read. The tree is formed when data is data. The advantage of the encoding method is that it can be adapted to any complex hierarchical data, the implementation method is simple, and the tree content is changed without changing the program code. Example Program and Main Code Analysis We use the tree structure of a city name as an example to explain the application of the coding method. First establish an encoding table: city_tab (administrative code, administrative name), its corresponding data window is dw_tree (in a hidden state), the corresponding tree control is TV_1.

转载请注明原文地址:https://www.9cbs.com/read-31087.html

New Post(0)