Hi,
I have asked how to show the result of calculation of offline table.
http://longrange.lansa.com.au/viewtopic.php?f=11&t=507
I would like to get the sum of these result and show it as a label on the offline formview.
The vaule should be get when button is clicked on the formview.
Is it possible to implement with offline formveiw?
If yes, could you please let me know how to?
Best Regards,
Megumi Sawada
[RPG]offline - sum of calculation
-
MegumiSawada
- Posts: 268
- Joined: Tue Feb 19, 2013 5:18 pm
[RPG]offline - sum of calculation
- Attachments
-
- IMG_0163.PNG (47.02 KiB) Viewed 4495 times
-
tsupartono
- Posts: 289
- Joined: Wed Apr 18, 2012 10:21 am
Re: [RPG]offline - sum of calculation
Megumi,
If I understand your question correctly, the difference between this and your previous scenario is the trigger, when the calculated values will be displayed, this time the values will be calculated when a button is touched?
If that's the case, you can start with no binding for the calculated column, then as the user touched the "calculate" button, you'd use ECL to change the binding of the calculated column to SELECT number2 - number1.
ECL code snippet:
If I understand your question correctly, the difference between this and your previous scenario is the trigger, when the calculated values will be displayed, this time the values will be calculated when a button is touched?
If that's the case, you can start with no binding for the calculated column, then as the user touched the "calculate" button, you'd use ECL to change the binding of the calculated column to SELECT number2 - number1.
ECL code snippet:
Code: Select all
lrexec
(
function()
{
// We are assuming that the calculated column is COL%4 (adjust accordingly)
// Do NOT change '$3' in the property name below, it indicates data binding
var p = "form.fields.mytable.col%4.content.value.$3.sql";
this.q_setProperty(p, ""select &(fld:number2) - &(fld:number1)");
}
}
-
MegumiSawada
- Posts: 268
- Joined: Tue Feb 19, 2013 5:18 pm
Re: [RPG]offline - sum of calculation
Hi Tony,
Thank you for your reply.
I would like to sum up these results when button is clicked.
Mytable.Row%1.Col%4 = 100
Mytable.Row%2.Col%4 = 200
Mytable.Row%3.Col%4 = 300
Mytable.Row%4.Col%4 = 400
Then I would liek to show the result of (100 + 200 + 300 + 400 ), i.e. 1000 as a label above the table.
I don't know how to do it with offline form...
Best Regards,
Megumi Sawada
Thank you for your reply.
I would like to sum up these results when button is clicked.
Mytable.Row%1.Col%4 = 100
Mytable.Row%2.Col%4 = 200
Mytable.Row%3.Col%4 = 300
Mytable.Row%4.Col%4 = 400
Then I would liek to show the result of (100 + 200 + 300 + 400 ), i.e. 1000 as a label above the table.
I don't know how to do it with offline form...
Best Regards,
Megumi Sawada
-
tsupartono
- Posts: 289
- Joined: Wed Apr 18, 2012 10:21 am
Re: [RPG]offline - sum of calculation
There is a solution where the total would be calculated automatically without the end-user having to press a button.
Because the calculated column is NUMBER2 - NUMBER1, so the sum of that calculated values would be SUM(NUMBER2) - SUM(NUMBER1)
Let's say that your table on the form is showing values from a table called VALUES, you can get the sum of the calculated field using this SQL statement:
You just need to bind the label that would show the total to this SQL like so:
Because the calculated column is NUMBER2 - NUMBER1, so the sum of that calculated values would be SUM(NUMBER2) - SUM(NUMBER1)
Let's say that your table on the form is showing values from a table called VALUES, you can get the sum of the calculated field using this SQL statement:
Code: Select all
select sum(NUMBER2) - sum(NUMBER1) from VALUES
Code: Select all
A 3 10HTML('Type:Label
A Value.&.SQL:"
A select sum(NUMBER2)-sum(NUMBER1)
A from VALUES
A "
A ')
-
MegumiSawada
- Posts: 268
- Joined: Tue Feb 19, 2013 5:18 pm
Re: [RPG]offline - sum of calculation
Hi Tony,
Thank you for your reply.
The user's requirement is a bit more complex, but I think I can make it work based on your advice.
Thank you!
Best Regards,
Megumi Sawada
Thank you for your reply.
The user's requirement is a bit more complex, but I think I can make it work based on your advice.
Thank you!
Best Regards,
Megumi Sawada