In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
The content of this article mainly focuses on how to skillfully use the flag field to realize the temporary storage and locking of the filled data in big data. The content of the article is clear and easy to understand, and the organization is clear. It is very suitable for beginners to learn and worth reading. Interested friends can read along with Xiaobian. I hope everyone gets something out of this article!
demand scenarios
After the user enters the data, if the data is correct, click the lock button at the page end to lock the data, so as to prevent the wrong operation from affecting the data, and limit the data in the locked state to be valid data. Only valid data need to be counted when querying statistics.
solutions
For this requirement, we can add a flag field to the data table, and determine whether the data is in the "locked" state by the status of the flag field.
Here are the specific implementation steps:
I: Add field in data table: flag
When FLAG field is 0, it indicates that the data is temporary data, and when FLAG field is 1, it indicates that it is locked data.
II: Make order list according to demand, as shown in the following figure:
A3 cell type is dimension cell, expression =dd. (DDID), field name set to: dd.DDID
The cell types of B3~E3 are numerical cells, and the field names are set to the corresponding names in the data table respectively.
Multi-source SQL is used in data processing, and the data source is:
Next, let's look at how to control data by adding a flag bit field.
Add a data column (column F) after the report, set F3 cell to numeric cell, and set "FLAG" in the field name attribute, so that the status bit can be taken out from F3 cell, and the other cells can be controlled whether they can be written according to the value of F3. When the value is 1, it is locked.
Write the expression: F3!= in the editable expression of cells B3~E3 "1", so that F3 cells can be edited when they have a value other than 1 (non-state locked).
Reports can now be displayed to control whether data can be modified based on the value of the status bit. Next, let's look at how to control the flag value of the status bit.
The user clicks the lock button at the end of the page, so the status bit in the report can be changed first when clicking the button, and then the data saving operation can be executed. The change of the value of the status bit can be realized by changing the value of the report cell (F2) through javascript script.
Next, look at the F2 cell settings, as shown in the figure:
Cell F2 is both controlled by js and writes its value back to the database table. When writing back data through multi-source SQL, you need to set the expression. Here, set the F2 cell type to numeric type, and write: a.TYPE in the field name, which means that the F2 cell is placed in the object a, and the name is TYPE, and the initial value in the data table is to be read for this cell, so write =F3 in the cell. Then set the following in the data destination of data processing:
In other words, the value of a.TYPE will be saved to the FLAG field when saving. Here, a.TYPE is converted to a string by the string() function, so that the value of the F2 cell can be saved to the corresponding status bit of the database table. F column is the control status column. After setting, set the column width to 0.
Let's look at how to dynamically change the value of F2.
1. Add a lock button to the report toolbar.
The report toolbar is introduced in showInput. jsp: inputtoolbar.jsp. Open it with a text editor and add a button inside:
');return false;" href="#"> Lock
Note: Button style can be set by yourself. Simple text is used here.
2. Add js function to showInput.jsp
function save(arg1){
document.getElementById(arg1+"0_F"+2).setAttribute("value","1");
_inputSubmit(arg1);//Save report
}
The js function controls that if the lock button is clicked on the page end, the value of the F2 cell is set to 1, and then the save report operation is executed, so that the flag bit can be saved to the database.
The page reads as follows:
Then hide column F (column width set to 0)
In this way, we can click on the "lock" button to lock the data from being modified again at the end of the page.
If you need to query statistics only for locked valid data, you only need to add FLAG='1' to the where condition.
Thank you for your reading. I believe you have a certain understanding of the problem of "how to use the flag field skillfully to realize the temporary storage and locking of the filled data in big data." Go to practice quickly. If you want to know more relevant knowledge points, you can pay attention to the website! The editor will continue to bring better articles to everyone!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.