ainulm
9th August 2014, 03:26
Hi All,
I would like to ask. How should i calculate sum for a "variable A" that has been declared in program script.
Eg.
Variable A: rep.acp.amount.
Since i cannot access to program script. may I know how to handle this problem? (fyi:I have tried using function total in Aggregate Function, but the value is not right)
Thanks for those who help.
bdittmar
9th August 2014, 13:21
Hi All,
I would like to ask. How should i calculate sum for a "variable A" that has been declared in program script.
Eg.
Variable A: rep.acp.amount.
Since i cannot access to program script. may I know how to handle this problem? (fyi:I have tried using function total in Aggregate Function, but the value is not right)
Thanks for those who help.
Hello,
you say A is declared in program script, so you have access to program script.
Therefor calculation can be done in selectdo with A = A + amount
If i'm not right, give more details for your requirement, please
Regards
ainulm
11th August 2014, 02:32
Hi Bernd,
Thank you for your reply,
My system does not have developer license. So i dont have access to Program Script.
I want to calculate total in report "Print Related Sales Invoices and Purchase Invoices".
User required to have total in Sales Invoices and Purchase Invoices.
Eg:In After.field report, I have select total in 'Aggregate Function' for Sales Invoices. But the problem arise when it sum for both Sales Invoices and Purchase Invoices amount. How should i make a total for only Sales Invoices? Please help. You may refer to attachment for more details.
Thank you in advance
bdittmar
11th August 2014, 08:19
Hi Bernd,
Thank you for your reply,
My system does not have developer license. So i dont have access to Program Script.
I want to calculate total in report "Print Related Sales Invoices and Purchase Invoices".
User required to have total in Sales Invoices and Purchase Invoices.
Eg:In After.field report, I have select total in 'Aggregate Function' for Sales Invoices. But the problem arise when it sum for both Sales Invoices and Purchase Invoices amount. How should i make a total for only Sales Invoices? Please help. You may refer to attachment for more details.
Thank you in advance
Hello,
try to use the TOTALs with print condition (SALES , PURCHASE)
Regards
ainulm
11th August 2014, 09:08
Hi Bernd,
Ive tried to put the field "rep.sli.amount" which represent as "Sales Invoice" amount in the print condition. but it doesnt change anything. please help. :(
bhushanchanda
11th August 2014, 10:04
Hi,
One more thing you can try is, I guess you might be having access to Report Script. If yes, then you can declare one more variable. In the layout section of the Sales Invoices, in before.layout subsection, keep adding the amounts and add this on the report layout.
ainulm
11th August 2014, 10:15
Hi bhushanchanda,
thank you for your reply.
Yes, i do have access to Report Script. I dont understand what you mean for 'keep adding the amounts',
can you please guide me in details? im still new in creating script in report. :(
bhushanchanda
11th August 2014, 10:22
Hi,
Declare a variable in report script say, si.tot
Now, check the layout which is printing the Sales Invoice lines.
e.g if the layout is detail.1 and the amount printed is temp.amnt then, you can write this:-
detail.1:
before.layout:
si.tot = si.tot + temp.amnt
Hence, after all the lines are printed, you will have si.tot which is storing the total.
ainulm
11th August 2014, 10:40
Hi Bhushan,
I tried using your method. but it display as '0.00'. I set as 'amount' in the layout field.
Below is my script, please let me know if i did anything wrong. thank you.
declaration:
extern domain tcamnt amount
after.field.1:
before.layout:
amount = amount + rep.acp.amount
bhushanchanda
11th August 2014, 10:43
Hi,
Yes, you are adding the total amounts. Please use the layout section which is printing the detail lines.
If possible post a snapshot of your layouts.
ainulm
11th August 2014, 11:19
Hi Bhushan,
User request not to print details. They just want to print the total amount of Purchase Invoice and Sales Invoice separately.
Please refer the attachment for my layout.
So the value for each Total Sales Invoice and Total Purchase Invoice should be print accordingly.
Problem happen when both Total Sales Invoice and Total Purchase Invoice sum up the whole amount. Please help. :(
bhushanchanda
11th August 2014, 11:47
Hi,
Make 1 as output expression in detail 1 and 2.
In report script write:-
detail.1:
before.layout:
sal.tot = sal.tot + variable_used_in_detail_as_sales_invoice_amount
lattr.print = false
detail.2:
before.layout:
put.tot = put.tot + variable_used_in_detail_as_purchase_invoice_amount
lattr.print = false
Now,
These two variables will have the total amounts of purchase and sales.
Try debugging the report if the variables are getting the values or not.
Also make sure, if you are declaring the two variables in report script, do not add them as Report Input fields else they will always be printed as 0.
bdittmar
11th August 2014, 13:04
Hi Bernd,
Ive tried to put the field "rep.sli.amount" which represent as "Sales Invoice" amount in the print condition. but it doesnt change anything. please help. :(
Hello,
is it a customized Report or a standard Report ?
What is the session and reportcode?
Regards
ainulm
14th August 2014, 04:01
Hai Bhushan,
Sorry for late reply.
I keep trying your propose code,
but why the value display ad hashtag. may refer to the attachment for details.
Please help. :confused::confused:
Thank you in advance.
bdittmar
14th August 2014, 08:20
Hai Bhushan,
Sorry for late reply.
I keep trying your propose code,
but why the value display ad hashtag. may refer to the attachment for details.
Please help. :confused::confused:
Thank you in advance.
Hello,
use another Format for field.
###### means, cannot Display because value is to big.
Regards
bhushanchanda
14th August 2014, 08:29
Hi,
Also in report script initialize the two variables-
before.program:
sal.tot=0
pur.tot=0
ainulm
14th August 2014, 08:51
Hai Bernd,
Thank you for your reply.
I have tried used other format. the value is display.
But when i calculate manually the value is different. is it the code correct?
Bhushan,
1. I have verified that im adding the amount at the both detail layout.
2. I did not set 'TOTAL' in the after.field layout.
Is there anything wrong with my code? please help :(
Thank you in advance
bhushanchanda
14th August 2014, 09:38
Hi,
Check 2 things:-
1. Verify that you are not adding the total fields but the amounts in detail layout.
2. Check if you are not selecting the "TOTAL" for both the fields in the layout.
Aryaraj
19th September 2015, 12:21
Dear Sir,
When we go to report layout that time after inserting a field we can use aggregate function total but I want to use it in program script.How can we use it? or after printing the report whatever is printed with aggregate function can we store it in variable for further processing?
Regards
Aarya
bhushanchanda
19th September 2015, 13:03
Yes, you can. Though its not advisable as any changes to layout i.e. adding or removing any total field will need a script retrofit as well. You can use following in your report script.
total..0 (first total of layout)
total..1 (second total of layout)
...
And so on.
Note that, the order of total..x will change if there is any layout changes.
Aryaraj
24th September 2015, 11:51
Dear Bhushan Sir,
I tried total(variable name) at report script but while compiling the report system gives error message as Error: Unresolved reference to function 'total'.
What else can we try?
Regards
Aarya
bhushanchanda
24th September 2015, 12:30
Hi,
You don't need any variable names. If you have 3 total fields in your report layout, you can access them using-
total..0
total..1
total..2
Aryaraj
25th September 2015, 11:43
Dear Bhushan sir,
Its working.
Thaaaxxxxx alots.
Regards
Aarya
mark_h
25th September 2015, 17:31
Keep in mind if you modify the report, and or subtract other total fields then the total.. variables might change which field they represent. Just something you need to be aware of when using total.. variables.