IMPORTANT ANNOUNCEMENT

These forums were permanently set to read-only mode on July 20, 2022. From that day onwards, no new posting or comment is allowed on the site, but the historical content remains intact and searchable.

A new location for posting questions about PlanetPress Suite is now available:

OL Learn - PlanetPress Classic (opens in new tab)

Page 2 of 2 < 1 2
Topic Options
#57327 - 11/26/19 07:00 AM Re: Calculate total of calculated Extended Prices [Re: Stephenlnoe]
jim3108 Offline
OL Expert

Registered: 04/19/10
Posts: 316
Loc: London, UK
That shouldn't make a difference as a whole number such as "1" would just be "1.00" in currency format.

The issue appears to be the use of &currentiteration and it not being in scope. This will happen when you don't have a repeat set in the object. Can you confirm that you are doing a line repeat in this Text Object?

Regards,

James.

Top
#57328 - 11/26/19 12:42 PM Re: Calculate total of calculated Extended Prices [Re: Stephenlnoe]
Stephenlnoe Offline
OL Newbie

Registered: 11/07/19
Posts: 20
Thank you James.
Yes, I am doing line repeat to fill in the table detail for 'extended price' I had to manually cycle the iterations because I use a custom data selection. I have to use the custom data selection to format the 'unit price' strtocur and to do the calculation of unit price * qty. Because the iterations do not cycle when using a custom data selection I had to manually increment. This all works perfectly in the table detail.

Now, in the footer detail for 'subtotal' I need the sum totals of all the extended cost line items(which were calculated in the table detail). This could be a separate calculation.

In order to get the extended price I wrote this:

=curtostr(strtocur(strip('*', XmlGet('/Document[1]/Page[1]/CommercialInvoice[1]/CILines[1]/CILine['+inttostr(&currentiteration)+']/ShippedQty[1]'))) * strtocur(trim(XmlGet('/Document[1]/Page[1]/CommercialInvoice[1]/CILines[1]/CILine['+inttostr(&currentiteration)+']/UnitPrice[1]'))))

This formula works for each iteration and cycles correctly for the invoice table inside of the textbox which I'm using line repeat in.

The footer where the 'subtotal' value needs to be is not in that text box where I'm doing line repeat. It is it's own text box.

Top
#57329 - 11/26/19 12:47 PM Re: Calculate total of calculated Extended Prices [Re: Stephenlnoe]
Jean-Cédric Offline
OL Expert

Registered: 10/03/16
Posts: 681
Loc: Québec, Canada
Then you have to define your own iterator variable, inside your loop, and it should work.
_________________________
♪♫♪♫
99 frigging bugs in my code
99 frigging bugs
Take one down
Code around
127 frigging bugs in my code
♪♫♪♫

Top
#57330 - 11/26/19 12:48 PM Re: Calculate total of calculated Extended Prices [Re: Stephenlnoe]
Stephenlnoe Offline
OL Newbie

Registered: 11/07/19
Posts: 20
OK, I see where I went wrong.

I needed to add the code to the table detail text box which is doing the line repeat and add the presstalk after to set it into the global variable. Then use the global variable in the footer.

TY!

Top
#57331 - 11/26/19 01:16 PM Re: Calculate total of calculated Extended Prices [Re: Stephenlnoe]
Stephenlnoe Offline
OL Newbie

Registered: 11/07/19
Posts: 20
The only thing left is to add the commas to the amounts because the values are sometimes millions.

I do not see a reference to that type of formatting in my manual. Is this something simple or does it require a plugin? or?

Top
#57332 - 11/26/19 01:22 PM Re: Calculate total of calculated Extended Prices [Re: Stephenlnoe]
Jean-Cédric Offline
OL Expert

Registered: 10/03/16
Posts: 681
Loc: Québec, Canada
You need to code it yourself. It shouldn't be to complicated.
I would setup a function which receives the current amount (in string format) and returns the formatted string, with commas.

Simply loop through all characters backward, starting at the first one before the decimal "dot".

Every third character, you add a comma.
_________________________
♪♫♪♫
99 frigging bugs in my code
99 frigging bugs
Take one down
Code around
127 frigging bugs in my code
♪♫♪♫

Top
#57333 - 11/26/19 03:02 PM Re: Calculate total of calculated Extended Prices [Re: Stephenlnoe]
Stephenlnoe Offline
OL Newbie

Registered: 11/07/19
Posts: 20
OK, got it. ty

Top
Page 2 of 2 < 1 2