Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
| Search | Today's Posts | Mark Forums Read
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 23rd, 2009, 04:51 PM
Registered User
 
Join Date: Oct 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default How can I convert an excel formula to javascript

How can I convert the following excel formula to javascript I can use in a PDF calculation?

If (B4 > B3, B3-B4,"")

Any help would be appreciated.
 
Old October 23rd, 2009, 09:01 PM
Friend of Wrox
 
Join Date: Jun 2008
Location: Snohomish, WA, USA
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

How can you use JavaScript to do a PDF calculation??? That's a much bigger question!

And where are you getting the *cells* from in JavaScript to emulate a spreadsheet, in the first place???

Oh, well. The JS equivalent would be:
Code:
     ( B4 > B3 ? B3 - B4 : "" )
 
Old October 23rd, 2009, 09:30 PM
Registered User
 
Join Date: Oct 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am sorry, the PDF fields refered to are as follows:

B4 = Field "Deposit"
B3 = Field "GT
The field this calculation is going into is called "REFUND"
I do not know a lot about javascript but I do know you have to define var
Thank you for your post and any other help you can give me on this.
 
Old October 23rd, 2009, 10:03 PM
Friend of Wrox
 
Join Date: Jun 2008
Location: Snohomish, WA, USA
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

I *still* don't have the foggiest idea how JavaScript can affect the contents of a PDF file. So far as I know, JavaScript won't even be aware that you are using the browser to display a PDF file.

Can you show an example page that uses JS to affect PDF in any way???

Ahhhh....wait! You are referring to using JavaScript in Acrobat *developer*, not in the reader, is that right???

Okay...then my basic answer is correct:
Code:
REFUND =  ( Deposit > GT ? GT - Deposit : "" );
But presumably you must use Adobe's DOM to specify those fields in the document more clearly.

And that I know *nothing* about.




Similar Threads
Thread Thread Starter Forum Replies Last Post
convert Excel formula to JavaScript amwith Javascript How-To 3 March 7th, 2008 06:31 AM
Excel to Javascript formula assistance recei Javascript How-To 1 February 6th, 2007 10:25 AM
Excel calculations convert to pdf via javascript evetteogden Javascript How-To 0 May 31st, 2006 11:32 AM
Formula to convert date format narooma.12 Crystal Reports 0 April 20th, 2005 04:54 PM
converting excel formula to javascript bRvO Javascript How-To 10 January 10th, 2005 12:41 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.