Hot Topic (More than 10 Replies) An If, And, Question (Read 1567 times)
FlipGilbert
Full Member
***
Offline


Running Ver 2.6.4

Posts: 236
Location: Sandy Eggo
Joined: Mar 8th, 2005
An If, And, Question
Dec 29th, 2005 at 4:39pm
Print Post Print Post  
Can someon explain what I'm doing wrong? my code overwrites the data in LE( pe1) when it should skip it if it has data in it.
below is the code. and thanks for any help

var vNumber as Double
vNumber = "0"

If Not @IsBlank(List1) And @IsBlank(Pe1)
           {
                 vNumber = (List1 * (Odiscount / 100))      
                 Pe1 =  List1 - vNumber
           }
If Not @IsBlank(List2) And @IsBlank(pe2)
           {
                 vNumber = (List2 * (Odiscount / 100))      
                 Pe2 =  List2 - vNumber
           }
  

It's not what a man says that matters or how he says it, but what he does and how he does it.
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: An If, And, Question
Reply #1 - Dec 29th, 2005 at 4:54pm
Print Post Print Post  
Hello Flip,

The Not Statement is affecting both @IsBlank() calls in your If statements. Try it as the following

Code
Select All
 var vNumber as Double
vNumber = "0"

If @IsBlank(Pe1) And Not @IsBlank(List1)
  {
   vNumber = (List1 * (Odiscount / 100))
   Pe1 =  List1 - vNumber
  }
If @IsBlank(pe2) And Not @IsBlank(List2)
  {
   vNumber = (List2 * (Odiscount / 100))
   Pe2 =  List2 - vNumber
  } 



-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: An If, And, Question
Reply #2 - Dec 29th, 2005 at 5:06pm
Print Post Print Post  
Quote:
The Not Statement is affecting both @IsBlank() calls in your If statements.


To avoid this, I have gotten in the habbit of always grouping with Parentheses "( )" when an "and" or an "or" is used with "Not".

Like this:
If (Not @IsBlank(List1) ) And @IsBlank(Pe1)
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
FlipGilbert
Full Member
***
Offline


Running Ver 2.6.4

Posts: 236
Location: Sandy Eggo
Joined: Mar 8th, 2005
Re: An If, And, Question
Reply #3 - Dec 29th, 2005 at 6:26pm
Print Post Print Post  
Both worked well, Thank you both. Carl's was easier to reprogram. But not to worry Ray we still love you.
But that was just first obstacle, here is the other.
Im trying to get the 2nd and 3rd if not conditions to post, and there not.

If (Not @IsBlank(brp2))
     {
           xpost(@fn, brp2, "brpinv!brp_no", oname, "Last_Purchased_From", "")
           xpost(@fn, brp2, "brpinv!brp_no", opo, "po", "")
           xpost(@fn, brp2, "brpinv!brp_no", odate, "Last_Purchased_On", "")
           If (Not @IsBlank(pe2))
                 {
                       xpost(@fn, brp2, "brpinv!brp_no", pe2, "cost", "")
                 }
           If (Not @IsBlank(List2))
                 {
                       xpost(@fn, brp2, "brpinv!brp_no", List2, "List", "")
                 }
     }
  

It's not what a man says that matters or how he says it, but what he does and how he does it.
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: An If, And, Question
Reply #4 - Dec 29th, 2005 at 6:35pm
Print Post Print Post  
Is the XPost not working or are you not getting into the If statements? Give the following code a try and let me know what appears in the WriteLn Window.

Code
Select All
If (Not @IsBlank(brp2))
	{
		Writeln("Posting brp2 Data")
		xpost(@fn, brp2, "brpinv!brp_no", oname, "Last_Purchased_From", "")
		xpost(@fn, brp2, "brpinv!brp_no", opo, "po", "")
		xpost(@fn, brp2, "brpinv!brp_no", odate, "Last_Purchased_On", "")
		If (Not @IsBlank(pe2))
			{
				xpost(@fn, brp2, "brpinv!brp_no", pe2, "cost", "")
				Writeln("In the PE2 Loop. Error Status: " + @Error)
			}
		If (Not @IsBlank(List2))
			{
				xpost(@fn, brp2, "brpinv!brp_no", List2, "List", "")
				Writeln("In the List2 Loop. Error Status: " + @Error)
			}
	}
 



-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
FlipGilbert
Full Member
***
Offline


Running Ver 2.6.4

Posts: 236
Location: Sandy Eggo
Joined: Mar 8th, 2005
Re: An If, And, Question
Reply #5 - Dec 29th, 2005 at 7:00pm
Print Post Print Post  
hummm, It is normally in form exit but I put the code in a element exit to test it and while testing it nothing appears in the WriteLn window. strange
  

It's not what a man says that matters or how he says it, but what he does and how he does it.
Back to top
 
IP Logged
 
FlipGilbert
Full Member
***
Offline


Running Ver 2.6.4

Posts: 236
Location: Sandy Eggo
Joined: Mar 8th, 2005
Re: An If, And, Question
Reply #6 - Dec 29th, 2005 at 7:03pm
Print Post Print Post  
the three xpost after the primary if not blank work fine its the  other two if nots that are not functioning. if that helps, glad to see its not my spelling aggien!
  

It's not what a man says that matters or how he says it, but what he does and how he does it.
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: An If, And, Question
Reply #7 - Dec 29th, 2005 at 7:18pm
Print Post Print Post  
What Debug is showing up in the WriteLN Window?

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
FlipGilbert
Full Member
***
Offline


Running Ver 2.6.4

Posts: 236
Location: Sandy Eggo
Joined: Mar 8th, 2005
Re: An If, And, Question
Reply #8 - Dec 29th, 2005 at 8:20pm
Print Post Print Post  
Nothing, and I am running it from a live program.
  

It's not what a man says that matters or how he says it, but what he does and how he does it.
Back to top
 
IP Logged
 
FlipGilbert
Full Member
***
Offline


Running Ver 2.6.4

Posts: 236
Location: Sandy Eggo
Joined: Mar 8th, 2005
Re: An If, And, Question
Reply #9 - Dec 29th, 2005 at 8:21pm
Print Post Print Post  
oops, wait a sec.....
  

It's not what a man says that matters or how he says it, but what he does and how he does it.
Back to top
 
IP Logged
 
FlipGilbert
Full Member
***
Offline


Running Ver 2.6.4

Posts: 236
Location: Sandy Eggo
Joined: Mar 8th, 2005
Re: An If, And, Question
Reply #10 - Dec 29th, 2005 at 8:27pm
Print Post Print Post  
ok, put in the RIGHT le on field exit and it said no on both errors and when I checked the xpost it worked? it seems not to be xposting on exit form but it does on exit field...?
  

It's not what a man says that matters or how he says it, but what he does and how he does it.
Back to top
 
IP Logged
 
FlipGilbert
Full Member
***
Offline


Running Ver 2.6.4

Posts: 236
Location: Sandy Eggo
Joined: Mar 8th, 2005
Re: An If, And, Question
Reply #11 - Dec 29th, 2005 at 8:34pm
Print Post Print Post  
went back and tried to edit it and NOW I get a yes on both errors. I think its time to dummy this code down
  

It's not what a man says that matters or how he says it, but what he does and how he does it.
Back to top
 
IP Logged
 
FlipGilbert
Full Member
***
Offline


Running Ver 2.6.4

Posts: 236
Location: Sandy Eggo
Joined: Mar 8th, 2005
Re: An If, And, Question
Reply #12 - Dec 29th, 2005 at 8:37pm
Print Post Print Post  
because I had the xpost form open in another tab... seems the code is working on the exit field not the exit form
  

It's not what a man says that matters or how he says it, but what he does and how he does it.
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: An If, And, Question
Reply #13 - Dec 29th, 2005 at 8:48pm
Print Post Print Post  
Flip,

You have lost me. So is the code working or is it not working?

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
FlipGilbert
Full Member
***
Offline


Running Ver 2.6.4

Posts: 236
Location: Sandy Eggo
Joined: Mar 8th, 2005
Re: An If, And, Question
Reply #14 - Dec 29th, 2005 at 8:57pm
Print Post Print Post  
Sorry Ray,
Yes, the code works if I use it in an On Field Exit, BUT!
No, the code does not work if in an ON Form Exit.
does that make sense?
  

It's not what a man says that matters or how he says it, but what he does and how he does it.
Back to top
 
IP Logged