Skip to main content
Participant
March 18, 2021
Answered

Percentage calculation and save to conditional text

  • March 18, 2021
  • 2 replies
  • 469 views

Hi to all. I would like ask for help in this situation. I have a book with about 300 pages. Each page has many numbers (prices). I have to calculate each selected number by 1% (num*1,01) and maybe round that number at two places up. And the result save as the condition text. Can someone please help me write a script that could do this? Thank you for any help.

This topic has been closed for replies.
Correct answer jctremblay

1. Create two Conditional Text. 100Price, 101Price
2. Do a GREP Search to match all price, change to to create duplicate of them
3. Do a GREP Search to match the first instance of the duplicate and apply 100Price condition
4. Do a GREP Search to match the second instance of the price and apply 101Price condition
5. Hide 100Price condition
6. Run PriceAdjuster from Peter Kahrel

Done!

If you need help writing the 3 GREP for this, come back with a screen capture with hidden charcater of your price. Or how the price is written.

2 replies

jctremblay
Community Expert
jctremblayCommunity ExpertCorrect answer
Community Expert
March 18, 2021

1. Create two Conditional Text. 100Price, 101Price
2. Do a GREP Search to match all price, change to to create duplicate of them
3. Do a GREP Search to match the first instance of the duplicate and apply 100Price condition
4. Do a GREP Search to match the second instance of the price and apply 101Price condition
5. Hide 100Price condition
6. Run PriceAdjuster from Peter Kahrel

Done!

If you need help writing the 3 GREP for this, come back with a screen capture with hidden charcater of your price. Or how the price is written.

HKropiAuthor
Participant
March 18, 2021

Thank you. Process which Jean-Claude wrote will work fine for me. Once more all of you thanks!

Colin Flashman
Community Expert
Community Expert
March 18, 2021

Peter Kahrel has already written something like this. Check his script out here:

 

https://creativepro.com/files/kahrel/indesign/price_adjuster.html

If the answer wasn't in my post, perhaps it might be on my blog at colecandoo!