Solved

Verifying totals

Posted on 2002-03-15
22
194 Views
Last Modified: 2013-12-18
Okay..I have four fields on a form.  A B C D  They are all used to input a number of copies needed for a Copy Production Center form.

A + B should always equal C + D

Is there a simple formula or lotus script to add this to the submit button as a validation before submitting the form?  If so, can anyone tell me what that might be?

Thanks so much!
Janette
0
Comment
Question by:jk9783
  • 9
  • 8
  • 3
  • +1
22 Comments
 
LVL 10

Expert Comment

by:zvonko
ID: 6868626
Does this formula do the job?
FIELD A:=A;
FIELD B:=B;
FIELD C:=C;
FIELD D:=D;

REM "Basic field checking. Do it here or direct in fields...";
@If(@isError(@TextToNumber(@Text(A)));@Return(@Prompt([OK];"Error";"Wrong A value."));"");
@If(@isError(@TextToNumber(@Text(B)));@Return(@Prompt([OK];"Error";"Wrong B value."));"");
@If(@isError(@TextToNumber(@Text(C)));@Return(@Prompt([OK];"Error";"Wrong C value."));"");
@If(@isError(@TextToNumber(@Text(D)));@Return(@Prompt([OK];"Error";"Wrong D value."));"");

REM "This is the Sum check you asked for...";
@If((A+B)!=(C+D);@Return(@Prompt([OK];"Error";"A+B <> C+D"));"");

REM "here flows your submit code...";


=========================================
Of course upper formula works only if your four fields are of type Number.
Otherwise convert the four values to number for checking, like this:
@If((@TextToNumber(A)+@TextToNumber(B))!=(@TextToNumber(C)+@TextToNumber(D));@Return(@Prompt([OK];"Error";"A+B <> C+D"));"");

Good luck,
zvonko
0
 
LVL 10

Accepted Solution

by:
zvonko earned 50 total points
ID: 6869303
Hello Janette,

if you prefer doing it in LotusScript, then use this code:
Sub Click(Source As Button)
  Dim workspace As New NotesUIWorkspace
  Dim uidoc As NotesUIDocument
  Set uidoc = workspace.CurrentDocument
  If ((Cint("0" & uidoc.FieldGetText( "A" )) + _
       Cint("0" & uidoc.FieldGetText( "B" ))) <> _
      (Cint("0" & uidoc.FieldGetText( "C" )) + _
       Cint("0" & uidoc.FieldGetText( "D" )))) Then
    Messagebox( "A + B <> C + D" )  
  Else
    'submit :-)
  End If
End Sub

<|:-)
0
 
LVL 9

Expert Comment

by:Arunkumar
ID: 6869409
Hi Zvo!
0
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
LVL 10

Expert Comment

by:zvonko
ID: 6869439
Hi Bro :-)
0
 
LVL 9

Expert Comment

by:Arunkumar
ID: 6870985
you know what ?  I got a cable modem, and now my keyboard is broken.  The internet hates me !
0
 
LVL 10

Expert Comment

by:zvonko
ID: 6870997
still better then your joystick get broken <|;-)

Do you mean Janette can help?

(uups :>) ... I mean with the keyboard :-)



0
 
LVL 9

Expert Comment

by:Arunkumar
ID: 6871082
Hey you know what ?  I was so dumb that the switch at the back of the keyboard was off...And i realised it only now!

;-)
0
 
LVL 10

Expert Comment

by:zvonko
ID: 6871815

it is all right as long as you find Karen's dip switches to turn her on ;-)

Keybord is second impotant :-)


0
 
LVL 9

Expert Comment

by:Arunkumar
ID: 6871963
haa haa haa that was a good one... by the way who is karen ???

:-P
0
 

Expert Comment

by:giusepe
ID: 6878958
are you working in a form for a web application or notes client ??

this is because if you are doing this submit button for the web, you can accomplish the validation  with JavaScript in the client side !!
0
 

Expert Comment

by:giusepe
ID: 6878963
by the way Arunkumar and Zvonko, you have some information about technical conferences for Domino, Linux, programming, etc. to be held in Atlanta, Georgia USA ??

the thing is that i am going to fly this next wednesday for my holidays to Atlanta and i am trying to get information to assist to some tech conferences.

or maybe you can tell me where i can get this information !!

i am not from United States.

0
 
LVL 10

Expert Comment

by:zvonko
ID: 6879073
sorry to bring bad news, but Antlanta is over:
http://www.lotus.com/world/usa.nsf/frame?OpenForm&/world/usa.nsf/allpublic/024F806B745EFA4685256B4A00586FB5

The next Lotus (IBM :-) DevCon is here:
http://www-3.ibm.com/events/ibmdeveloperworkslive/registration.html

Nice trip anyways,
zvonko


0
 

Author Comment

by:jk9783
ID: 7203785
This is a project that's fallen to the wayside and I don't see me having the time to pick it up again anytime soon.

I have not had a chance to check any of your suggestions (shame on me). I would like to take care of this question, though.

Would you like to share the points or delete the Q or what?  It's up to you guys since I have pretty much wasted your time on this question since I won't have the time to follow through with it.  

I do appreciate all of your help, though.

Janette
0
 
LVL 10

Expert Comment

by:zvonko
ID: 7203800
Hello Janette,

I offered two tested variants, so I vote NOT to give points to my Bro Arun :-)

In any case I am happy you found the time to clean up this question. We have so many abandoned questions here.

And generally, it's nice to here from you again.

 
0
 
LVL 9

Expert Comment

by:Arunkumar
ID: 7203825
I thought you love me and ask janette to award me pts but you betrayed me my dear brother....

But Samir gave me a 200 just now.

:=)
0
 

Author Comment

by:jk9783
ID: 7203833
No, you're absolutely right.  I've gone through and actually looked at the question and you did offer legitimate help.  It's all yours.

Thanks again!!
0
 
LVL 10

Expert Comment

by:zvonko
ID: 7203881
As you can see Janette we are more joking and having fun here, so do not take it to serious :-)

Thanks for the points and hope next time to be of more help (together with lovely Arun :)

So long,
zvonko

0
 
LVL 9

Expert Comment

by:Arunkumar
ID: 7203902
You are my bro buddy !

Janette... Its all fun for us here so, dont you worry.  If you still feel something for me then you can post a 500 pt question and award me an "A" for it... I will retire from EE....

:-P
0
 
LVL 10

Expert Comment

by:zvonko
ID: 7203926
Don't do this Janette!!!

If he retires then it get pure work and no fun for me here :-)

(isn't this a declaration of love between Bro's :)

0
 
LVL 9

Expert Comment

by:Arunkumar
ID: 7203940
Okay If i reach 100k then I will retire.  Someday I will eventually reach that mark by either begging or stealing.

After that what ?  You can delay this but cannot stop the process.

But I can cut a deal with you. If you give me the 2000 pt then I may consider staying back at EE with you with usual fun stuff what do you say ?

Do you say our love costs only 500*4 ???  Lets live the way as it is okay ?

LOL!
-Arun.
0
 

Author Comment

by:jk9783
ID: 7204118
Well...a 500 pt question at an A had better involve you spending your vacation time in the cube next to me. I have a few projects I could definitely pass your time with. : )

Don't fret, I'm familiar enough with the workings of EE to understand the humor and banter that happens in serious questions.

Thanks again for your help! and the entertainment!
0
 
LVL 9

Expert Comment

by:Arunkumar
ID: 7204277
Hi Janette !

Did you know we guys have a mailing list and discuss in that list like crazee ???

We are always fun loving guys!

Take Care!
Arun.
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I thought it will be a good idea to make a post as it will help in case someone else faces these issues. I trust this gives an idea how each entry in Notes.ini can mean a lot for the Domino Server to be functioning properly. This article discusses t…
Lack of Storage capacity is a common problem that exists in every field of life. Here we are taking the case of Lotus Notes Emails, as we all know that we are totally depend on e-communication i.e. Emails. This article is fully dedicated to resolvin…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question