PDA

View Full Version : Automating a standard computation



chamster
09-17-2007, 10:54 PM
I have a Word document where i fill in a number of thingies to be paid for (the first element). Then, i need to multiply that number by a constant price of P (the second element) and present the result as a third element. Now, i wonder how one can go about to automate this procedure so i only need to enter the number of thingies.

TonyJollans
09-17-2007, 11:38 PM
The simple way to get you started, although you may well come back with more questions.

Insert a Table with three columns.
In column 1 enter the number of thingies
In column 2 enter the price per thingie
In column 3, select Table > Formuls from the menu
- - - by default it will show =SUM(LEFT) under formula
- - - change it to =PRODUCT(LEFT) and click OK

chamster
09-18-2007, 04:54 AM
Yes, you're right. I do have more questions.

I tried =SUM(ABOVE) and, as you mentioned, =PRODUCT(LEFT) and everything works as supposed to, except for two tiny details.

Tiny Detail One
I'd like to get the computed value to automatically get updated, as soon as the entered value changes.

Tiny Detail Two
I need to use the format as e.g. "123 567,89" but when the space is used, it affects the computation rather severily.

How do i resolve the problem i have with Tiny Detail One and Tiny Detail Two?

TonyJollans
09-18-2007, 11:38 AM
Tiny Detail One ...

You need to use a Word Form and have the data entry in FormFields (available off the Forms Toolbar) - if you set a FormField as "Calculate On Exit" then when you enter data all other affected fields are recalculated.

Tiny Detail Two ...

I'll come back to you. I thought I had this all worked out but then I found something which didn't work and I can't remember the details right now. It can be awkward if you want something other than the options provided.

fionabolt
09-20-2007, 01:57 AM
With Tiny Detail Two....

Is this not to do with your Control Panel, Regional and Language settings?

If the regional options for Number format are set to a format that has spaces for the thousands separator and commas for the decimal separator then the calculation should work correctly.

TonyJollans
09-20-2007, 03:44 AM
I have never seen this documented anywhere but I have had trouble trying to apply formats other than the built-in ones to FormFields.

What usually seems to work better is to apply it to the Field rather than the FormField. Leave the format in the FormField blank and then after closing the dialogue, press Alt+F9 to reveal field codes. You will see something like:

{ FORMTEXT { =Text1*Text2 } }

You can add a format directly to this:

{ FORMTEXT { =Text1*Text2 } \# "000 000,00" }

You do have to watch out because the whole field will be replaced if you edit the FormField afterwards. Also you can get strange interactions if you try to apply formats in both ways at the same time.

All that said, Fiona is probably right about the regional settings.

chamster
09-21-2007, 06:11 AM
I have never seen this documented anywhere but I have had trouble trying to apply formats other than the built-in ones to FormFields.

What usually seems to work better is to apply it to the Field rather than the FormField. Leave the format in the FormField blank and then after closing the dialogue, press Alt+F9 to reveal field codes. You will see something like:

{ FORMTEXT { =Text1*Text2 } }

You can add a format directly to this:

{ FORMTEXT { =Text1*Text2 } \# "000 000,00" }


It might be that i'm doing something stupid but i don't even get to copy an entered value from the text (i bookmarked them as numberA and numberB) into my table. I tried to use
{ FORMTEXT { =numberA } } and { FORMTEXT { =numberB } }

Since It could be tedious to work out by talking about it, i'll send an attachment for you to see. If it's too much work to go into detailj, just forget about it. It wasn't that big deal and i made it work so-so, if not perfect.

Also, i don't mean for anybody to edit the file. Just give a hint on where i go wrong. It's probably something very basic and obvious to a trained eye.

There will be no file because the limit is below 25kb for DOC. What a mysterious rule...

TonyJollans
09-21-2007, 08:42 AM
Just zip the file before attaching it - the limit for zips is bigger.