Saturday, October 23, 2010

How to control DATAWINDOW in PB modify column properties



Application in the preparation of management information systems, typically encounter a common problem is how to control under different conditions data in the table columns, such as for the same DATAWINDOW different users have different operations (such as for data entry personnel can change data , and for general inquiries, staff can not change the data), following on the payroll of a simple example to demonstrates the use of PB Ruhe in DATAWINDOW Lie of a modified form of control.

Basic payroll as follows:
Code name variable working hours of the basic wage wage wage jobs pay subsidized intellectuals
code name workdata basesa movesa stationsa bt othersa
char varchar char decimal decimal decimal decimal deciaml

There are two ways in PB can control the column attribute, one static, the other is dynamic ways. The so-called static approach is adopted in the column attribute option to achieve. Way is to use the so-called dynamic programming. Are introduced respectively:

First, the static method

(1) select a column in the datawindow MOUSE right after the point, select "properities" pops up after the system, a label, select "Edit" tab to "Display Only" option to the system to have more;
(2) or select the "Expression" tab, in the "Protect Express" fill in "1";
(3) or select the "Expression" tab, in the "Protect Express" fill in conditional expressions, such as working hours, staff can not be changed less than one year, then write "if (daysafter (date (workdate), today () ) <= 365,1,0) ";
(4) in datawindow in the value of a column of the Tab Order system to 0, the column due to lack of focus and not be modified;
(5) in the DataWindow Painter state Select Rows menu, then select the Update Properties, pop Specify Update Properties dialog box, set the Allow Updates empty.

Second, the dynamic modification method

(1) set for the protection of the entire Datawindow way: Using DataWindow Object The ReadOnly property can be set for the protection of the Datawindow way.
The syntax is: dw_1.Object.DataWindow.ReadOnly = value or dw_1.Modify ("DataWindow.ReadOnly (= value)"), including: value that Datawindow is read-only (read-only) state, it has two values : Yes and No. Yes that makes Datawindow as read-only; No on the contrary, the default value is No. For example: If you want Datawindow set to conservation, the corresponding event in the script contains the following code:
dw_1.Modify ("DataWindow.ReadOnly = Yes") or as:
dw_1.Object.DataWindow.ReadOnly = Yes
(2) protects only certain columns Datawindow
Method 1: Use column Protect property
The syntax is: dw_1.Object.name.Protect = integer or dw_1.Modify ("columnname.Protect (= integer)").
Parameter Description: cloumnname: In order to protect the column names; integer: the column to protect the state, a value of 0 or False when the column is not protected; value of 1 or True, the column is protected. For example, to set the column name to protect the state, the corresponding code: dw_1.Object.name.Protect = 1 or to: dw_1.Moidfy ("name.Protect = 1")
Method 2: Use column TabSequence property, in the program execution as needed TabOrder the column is set to 0, so as to achieve the purpose of protection.
The syntax is: dw_1.Object.name.TabSequence = number or dw_1.Modify ("columnname.TabSequence (= number)")
Parameter Description: columnname: to protect the column names; number: the column TabOrder value (0-32000).
For example, to set the column name to protect the state, the corresponding code:
dw_1.Object.name.TabSequence = 0
Or: dw_1.Modify ("name.Tabsequence = 0")
Method 3: Using the modified column ED99v properties DisplayOnly property values.
The syntax is: dw_1.Object.columnname.Edit.DisplayOnly = value or dw_1.Modify ("columnname.Edit.DisplayOnly (= value)")
Parameter Description: columnname: to protect the column names;
value: that the column is to show only (DisplayOnly) state, it has two values: Yes and No. Yes that does not allow the user to enter data (display only): No, by contrast, the default value is No.
For example: if the column name is set to only show events in the corresponding script contains the following code:
dw_1.Object.name.Edit.DisplayOnly = Yes
Or: dw_1.Modify ("name.Edit.DisplayOnly = Yes")
Although not with this method can be modified when the column but the column will be the focus of these other methods can not.

Third, selective protection of certain lines

DataWindow above methods will work for all lines, but to protect only some of these lines, you need to use the column to protect (Protect) attributes (values with the above method 2), but this is achieved in the establishment when the DataWindow . Methods: the DataWindow Sketchpad (Painter), double-click the appropriate column, the pop-up Column Object dialog box, select the Expressions page, write in the box after Protect if (conditional expression, 1,0). Flexible use of conditional expression can get a variety of protective effect.
(1) only allows to modify the new row inserted
In a DataWindow, sometimes there is a demand: do not allow the existing data can only browse changes, only the data entered by the user before allowing the new changes, then the expression is:
if (isrownew (), 0,1), or if (not isrownew (), 1,0)
(2) the protection of a column other columns according to the data
Such as staff salaries management, more than 5 years of work experience only when allowed to enter the intellectual subsidies (bt), bt the Protect are shown after the box: if (integer (mid (string (today (), 'yyyymmdd '), 1,4)) - integer (mid (workdata, 1,4))> 5,0,1)
(3) to protect the line can be determined only at execution time, and changing the management of such wages, assuming that only the wages of wage changes is change the input by, and generally only in the implementation of the conditions need to be established a variable, which requires the establishment of DataWindow data when a search for the specified parameters (such as the flag), then the column can be modified after the box Protect (user_name is the DataWindow in a, on behalf of the importer's name) :
if (user_name = flag, 0,1)
Also note that in practical applications the actual type parameters.
(4) add a flag in the table column
Basically, these methods require the line to protect certain rules to follow, no rules when these lines when the corresponding table in a marked increase in the specific column (set out name flag), values of 1 and 0, Protect in the other column and then the box directly after the flag of the expression. Run-time if the line flag = 1, the corresponding column in the bank is protected. Column value for the flag amendment, by the data administrator to modify or under certain circumstances flexibility in the program settings.







Recommended links:



ASP.NET 2.0 at the same time to prevent the same user login



Adobe is very fragile, then Photoshop it?



MJPEG to AVI



Everyone doing B2C Who will win?



Picked Games And Entertainment



World Cup counterparts: Illustrator drawing three cases of Football



Spot Cash: How A "worry" Zile!



Mito Xiu 1 Minute To Create Non-mainstream Days



ASF to MPEG



brief Screen Capture



Chinese WAY: do the best CAD China



"Dragon Century: Origins," the official prequel novel Translation Preview



MTS to MOV



Electrical and magnetic neurostimulation



No comments:

Post a Comment