• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 203
  • Last Modified:

Verifying totals

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
jk9783
Asked:
jk9783
  • 9
  • 8
  • 3
  • +1
1 Solution
 
zvonkoCommented:
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
 
zvonkoCommented:
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
 
ArunkumarCommented:
Hi Zvo!
0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

 
zvonkoCommented:
Hi Bro :-)
0
 
ArunkumarCommented:
you know what ?  I got a cable modem, and now my keyboard is broken.  The internet hates me !
0
 
zvonkoCommented:
still better then your joystick get broken <|;-)

Do you mean Janette can help?

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



0
 
ArunkumarCommented:
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
 
zvonkoCommented:

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

Keybord is second impotant :-)


0
 
ArunkumarCommented:
haa haa haa that was a good one... by the way who is karen ???

:-P
0
 
giusepeCommented:
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
 
giusepeCommented:
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
 
zvonkoCommented:
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
 
jk9783Author Commented:
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
 
zvonkoCommented:
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
 
ArunkumarCommented:
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
 
jk9783Author Commented:
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
 
zvonkoCommented:
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
 
ArunkumarCommented:
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
 
zvonkoCommented:
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
 
ArunkumarCommented:
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
 
jk9783Author Commented:
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
 
ArunkumarCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 9
  • 8
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now