Home > database >  PB in how to use a field to calculate the value of another field, beg ace!!!!!!
PB in how to use a field to calculate the value of another field, beg ace!!!!!!

Time:09-22

Table "personal account", for example:
Annual salary, salary two fields, how to calculate the monthly wage input after years salary automatically, strives for the code, be urgent!!!!!!

CodePudding user response:

Open the window, insert on the menu -> Computed Filed in fill in the field name/12

CodePudding user response:

[Quote=1/f, reference response:]

Open the window, insert on the menu -> Computed Filed in fill in the field name/12
[/Quote
Hello, this I know, but how will the data channel in the database?

CodePudding user response:

If the calculation domain in the detail, you can use getitemnumber obtained after calculating the value of the then there is the corresponding field in the datawindow in code assignment,

CodePudding user response:

Computational domain in detail, can make the calculation results with getitemnumber, then using setitem place the results to assign values to the related field, realize the synchronous changes, the computational domain, set to invisible, then see the effect is to modify a field, and another is changed automatically,

CodePudding user response:

reference 4 floor response:
computational domain in detail, can make the calculation results with getitemnumber, then using setitem place the results to assign values to the related field, realize the synchronous changes, the computational domain, set to invisible, then see the effect is to modify a field, and another is changed automatically,

Could you tell me how to write, this code should seek guidance!!!!!!

CodePudding user response:

Monthly salary you can actually do not set field, with the computational domain can be solved, real-time computation very convenient, don't need to read and write database

CodePudding user response:

In the datawindow SQL:
The select NGZ, ygz the from...

Such as the calculation domain Computed_1 NGZ/12

Save button in the clicked event:
Dec ldec_ygz
Long, c r
C=dw_1. Rowcount ()
For r=1 to c
Ldec_ygz=dw_1. Getitemnumber (r, 'Computed_1)
Dw_1. Setitem (r, 'ygz, ldec_ygz)
Next
If dw_1. The update ()=1 then//attached to input in wages and automatic correction of the monthly salary by inventory together
The rollback.
The else
commit;
end if

CodePudding user response:

Correction, the rollback to commit written backwards. The update ()=1 is a success.
  • Related