Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General MS InfoPath Questions / July 2005

Tip: Looking for answers? Try searching our database.

Using the If And code

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jeffshex - 13 Jul 2005 22:35 GMT
I know the if code to start off my will be:
if(parseInt(XDocument.DOM.selectSingleNode("//my:WeekTotal").text) < 40)
---Now I need to add in after that:
AND If my:AfterTotal is NOT Equal To my:WeekTotal - 40
---
I'm not sure how to use the code correctly for that 2nd half.
Any Ideas?
Greg Collins [InfoPath MVP] - 14 Jul 2005 01:13 GMT
Have you tried:

var iWeekTotal = parseInt(XDocument.DOM.selectSingleNode("//my:WeekTotal").text);
var iAfterTotal = parseInt(XDocument.DOM.selectSingleNode("//my:AfterTotal").text);

if(iWeekTotal< 40 && iAfterTotal != iWeekTotal-40)
{
   // your code here...
}

Signature

Greg Collins [InfoPath MVP]
Please visit: http://www.InfoPathDev.com

I know the if code to start off my will be:
if(parseInt(XDocument.DOM.selectSingleNode("//my:WeekTotal").text) < 40)
---Now I need to add in after that:
AND If my:AfterTotal is NOT Equal To my:WeekTotal - 40
---
I'm not sure how to use the code correctly for that 2nd half.
Any Ideas?
Jeffshex - 14 Jul 2005 15:16 GMT
I have not tried that, but I did get this way to work:
if(parseInt(XDocument.DOM.selectSingleNode("//my:WeekTotal").text) > 40
    if(parseInt(XDocument.DOM.selectSingleNode("//my:AfterTotal").text)!=(parseInt(XDocument.DOM.selectSingleNode("//my:WeekTotal").text)-40))

XDocument.UI.Alert("Your after hours are not all accounted for. Please
correct this in order to submit.")
----------------------------------------------------------------------------------------------
Now the tricky part is inserting it into this working existing code I have:
function CTRL186_7::OnClick(eventObj)
{
    // Submit code
if(parseInt(XDocument.DOM.selectSingleNode("//my:WeekTotal").text) <= 35){

var clicked = XDocument.UI.Confirm("Your week total is under 35 hours. Do
you wish to continue?",1);
if(clicked == 1) {
XDocument.Submit();
XDocument.UI.Alert("Your status report has been submitted successfully.");
Application.ActiveWindow.Close();
}

}
else{
XDocument.Submit();
XDocument.UI.Alert("Your status report has been submitted successfully.");
Application.ActiveWindow.Close();
}

}
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.