Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Negative as Positive Total? 1

Status
Not open for further replies.

supportsvc

Technical User
Jan 24, 2018
249
US
Hello,
I have this issue when trying to multiply the Quantity Shipped to the Unit Price to get Extended Total.
Which is, it turns it into a positive total since it's multiplying negative by negative.
I can't think of how to change it so it results in the correct negative / positive total?

Negative_kfse06.jpg
 
The field in red is the shared variable exchange rate
The selected in the 2nd image is the subreport
Not sure why there are 0's?
And the subreport data repeats every so often?
Repeat_b5oq1o.jpg


As well as why the USD Price/Unit is now the same as the USD Total Cost Ext?
Had to change it to

Code:
//if {AR_InvoiceHistoryDetail.ARMC_234_EntryCurrency} <>"USD"
//then {AR_InvoiceHistoryDetail.UnitPrice} / {AR_InvoiceHistoryDetail.ARMC_234_EntryRate} else {AR_InvoiceHistoryDetail.UnitPrice}

whileprintingrecords;
shared numbervar xchgrt;
numbervar FTPU;
numbervar sumFTPU;
if {AR_InvoiceHistoryDetail.ARMC_234_EntryCurrency} <>"USD" then
FTPU := {AR_InvoiceHistoryDetail.UnitPrice} / xchgrt else
FTPU := {AR_InvoiceHistoryDetail.UnitPrice};
sumFTPU := sumFTPU+FTPU;
FTPU //this will display the individual value while the sum in the previous line is collecting behind the scenes

 
 https://files.engineering.com/getfile.aspx?folder=d79929be-1ff7-4613-a432-e28ff48b020e&file=newsellbydate_custom.RPT
Remove your formula called {@Shared Var} within the subreport--you have created two variables with the same name of a different type--just leave the other one that you have (mis)labeled xhgrt.

You should also remove reference to {@Shared Var} in the subreport record selection formula. And why are you setting {CX_CurrencyCodeDetail.CurrencyCode} = "CAD"? Not sure what that means? Please explain. I am concerned that the xchgrt seems to have the same value throughout the report--shouldn't it change per country? And I don't know why page 1 shows zeros. Once you have removed that incorrect formula, please refresh the report and save with data and send again.

-LB
 
Please insert a detail_c in the main report and add a reset formula (sorry--I should have thought of this):

whileprintingrecords;
shared numbervar xchgrt := 0;

You can suppress the detail_c section.

I don't understand why you need this in the subreport selection formula: {CX_CurrencyCodeDetail.CurrencyCode} <> "USD"--you are already making the formulas in your main report conditional on this.

Please rerun and send after you make these changes.

-LB
 
No problem!
Thank you for your patience in working through this!

Anyway
Created Detail_c section
Created the @Reset formula
whileprintingrecords;
shared numbervar xchgrt := 0;

Suppressed Detail_c section

Same result in that it shows the subreport data at the start of some records.
Realized that the 0's are for when the currencycode is USD.

In Red is the current exchange rate and in purple is the exchange rate at the time of the invoice.

Repeat_adkd9j.jpg


Need to not show the subreport.
So I just suppressed each field in the subreport

Think it's all working and looking good now!
THANK YOU SO MUCH!

True. Does it matter?
 
So you’re saying you are all set then? You could have just gone into the subreport->section expert and suppressed each section instead of suppressing individual fields. FYI - I only wanted you to unsuppress the group footer temporarily so you could verify the value showing in the sub in comparison to the value appearing the main report.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top