How to calculate field values with vbscript

R

randyb

Lets say I have 4 fields. Lets call them fielda fieldb and fieldcpos and
fieldcneg

I want to do a calcualation of fieda - fieldb. If the result is pos I want
to put the result in fieldcpos if it is negative I want it in fieldcneg. I
do not see a way built in to infopath2003 to do that. I am assuming I need
scriptng to do it. How do I write this with vbscript.

A secondary question is where can I find a good resource for vbscript and
xpath. I have two books on infopath and the are not good at all for those
areas. I prefer a free online resource but will pay for a book if needed.

Thanks,

Randy
 
S

Shekar

Hi randyb
You can do this with rules as follows:
Add a new field "isNegOrPos" and set the result in (isNegOrPos = fielda -
fieldb) in first rule.
In second rule check if "isNegOrPos >= 0" set (fieldCPos = fielda - fieldb)
In third rule check if "isNegOrPos < 0" set (fieldCNeg = fielda - fieldb)

Hope this helps you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top