1
votes

We have designed Lotus Notes forms, where we are displaying the data from the external system in a tabular format. In the tabular display we have editable fields, where user enters amount in these editable fields. Now we need to add the data from these editable fields and display in the totals field at the bottom dynamically. Could some one please help me in this regard with code.

The current code: The current editable fields are with name: PE_TOBEPOSTED, PE_TOBEPOSTED1, PE_TOBEPOSTED3 and the total field is TOT_AMT. So in the field value of TOT_AMT the following code is written

w_postd := @Left(PE_TOBEPOSTED;15); 
w_postd := @ProperCase(@Name([CN];@Left(w_postd;15))); 
w_postd1 := @Left(PE_TOBEPOSTED1;15); w_postd1 := @ProperCase(@Name([CN];@Left(w_postd1;15))); 

TOT_AMT = w_postd + w_postd1 + w_postd2 

PS: I am just two weeks old in Lotus Notes development

Thanks.

Regards, Kishore

2
what does your current code look like? - Sam I am says Reinstate Monica
The current editable fields are with name: PE_TOBEPOSTED, PE_TOBEPOSTED1, PE_TOBEPOSTED3 and the total field is TOT_AMT. So in the field value of TOT_AMT the following code is written w_postd := @Left(PE_TOBEPOSTED;15); w_postd := @ProperCase(@Name([CN];@Left(w_postd;15))); w_postd1 := @Left(PE_TOBEPOSTED1;15); w_postd1 := @ProperCase(@Name([CN];@Left(w_postd1;15))); TOT_AMT = w_postd + w_postd1 + w_postd2 - Kishore
What, exactly, is the user entering in the fields PE_TOBEPOSTED, PE_TOBEPOSTED1, and PE_TOBEPOSTED2. The code you have shown is taking the first 15 characters of input from each field. It is treating those 15 characters as a fully distinguished user name! It is extracting the common name from the user name, and converting it to proper case. Then it is adding the names! Where are the numbers? - Richard Schwartz
In the input field user enters only numbers. Probably the code I mentioned is wrong. However now I am using @SUM(PE_TOBEPOSTED : PE_TOBEPOSTED1 : PE_TOBEPOSTED3); in the field value of TOT_AMT. - Kishore

2 Answers

2
votes

To sum values, there is an @SUM formula that works like this:

@SUM(PE_TOBEPOSTED : PE_TOBEPOSTED1 : PE_TOBEPOSTED3);

Here, the values listed within the parenthesis, and separated by colons, are the names of the fields you want to sum. So this assumes there is a number in the PE_TOBEPOSTED, PE_TOBEPOSTED1, and PE_TOBEPOSTED3 fields.

You can add a refresh button to cause the page to recalculate. The code for the button is:

@Command( [ViewRefreshFields] )
0
votes

Ok as you are totally new at this, there is a number of things you need to take into account.

First if you want the changes to happen while the user is interacting with the document in the Notes Client then you should use the NotesUIDocument object in LotusScript.

If you want the changes to happen when no UI is being interacted with you would use the NotesDocument Object.

I strongly recommend reviewing the Infocenter for the related documentation. Every LS Object reference has matching sample code.

For example here is the one for the NotesUIDocument on how to get a field from the document.

http://publib.boulder.ibm.com/infocenter/domhelp/v8r0/topic/com.ibm.designer.domino.main.doc/H_EXAMPLES_FIELDGETTEXT_METHOD.html

You would get the text from the related fields, then use CINT method to change the strings to Integer numbers, add them and send them back to the document.