Hi,
The customer use offline formview and there's a table element on it to show data from local database table.
That table has 3 columns, for example, as follows:
Col%1 --> CONTENT.TEXT.&( FLD: NUMBER1 )
Col%2 --> CONTENT.TEXT.&( FLD: NUMBER2 )
Then in Col%3, they would like to show the result of the calculation of (NUMBER2 - NUMBER1).
I don't know how to do this...Could I have your advice please?
Everytime the user changes the value of Col%1 or Col%2, the Col%3 value should be changed.
I'm not sure if it is possible or not...
I appreciate your kind advice.
Thank you in advance!
Best Regards,
Megumi Sawada
[RPG] offline - show the result of the calculation
-
MegumiSawada
- Posts: 268
- Joined: Tue Feb 19, 2013 5:18 pm
[RPG] offline - show the result of the calculation
- Attachments
-
- IMG_0163.PNG (45.18 KiB) Viewed 3052 times
-
tsupartono
- Posts: 289
- Joined: Wed Apr 18, 2012 10:21 am
Re: [RPG] offline - show the result of the calculation
Yes it's possible to do that.
Your column 3 should bind to an SQL statement that calculates the diference between the two fields, like so:
Then you'd need to tell LR to refresh the form (so that the effective values from the binding are recalculated) when the the value of either textbox A or B has changed, by setting up an OnValueChanged handler for both NUMBER1 and NUMBER2 column. An example of setting it up for NUMBER1 column:
Note however that data binding works best when you have a moderate amount of data. If you have too many rows in the table (on the form), you'd have a performance issue when binding to SQL statements in conjunction with frequent form refresh. In that case, you might be better off with using imperative style (ECL).
Your column 3 should bind to an SQL statement that calculates the diference between the two fields, like so:
Code: Select all
A Col%3 +
A ( +
A Type: Label +
A Content.Text.&.SQL:
A "SELECT &(FLD:NUMBER2) - &(FLD:NUMBER1)"
A )
Code: Select all
A Name: NUMBER1 +
A Type: TextBox +
A Content.Value.& ( FLD:NUMBER1 ) +
A Content.OnValueChange (
A Operation.Type:RefreshForm)
-
MegumiSawada
- Posts: 268
- Joined: Tue Feb 19, 2013 5:18 pm
Re: [RPG] offline - show the result of the calculation
Hi Tony,
Thank you!
I have confirmed it works as expected!
Best Regards,
Megumi
Thank you!
I have confirmed it works as expected!
Best Regards,
Megumi