Formula using 'Else' or 'Or'

General support, questions, and comments

Moderators: SwiftWiz, BET, SwiftGuy, SwiftBB

Forum rules
This Forum was created for PlanSwift users to post questions and ideas for and about the PlanSwift software only. Please do a search before posting to the forums. Your question may have been answered already.

PlanSwift will not tolerate inappropriate posting of any information relating to race, nationality, political preference, or adult oriented materials. Spamming or advertising other products not related to the integration of PlanSwift is not permitted.

Failure to comply with this Policy can result in a temporary or permanent ban of a user from this board at the discretion of the PlanSwift Management.

Formula using 'Else' or 'Or'

Postby CSG99 » Tue Mar 13, 2012 12:09 pm

Can anyone see whats wrong with my formula, or can this not be done? if ('[..\..\Fab Location]' = '[..\Location]') then Result:= '0'
Else if (‘[..\Stock Type]’ = ‘Purchased’) then Result:= '0'
else Result:= [..]*[Typical Takeoff Qty] I've tried it with 'Else' & 'Or', but neither seem to work. I've also tried taking the '0' out of single quotes but it works if I don't use the 'Else'. Please advise. Thanks
CSG99
PowerSwift
 
Posts: 92
Joined: Mon Jun 20, 2011 1:30 pm

Re: Formula using 'Else' or 'Or'

Postby BET » Tue Mar 13, 2012 4:41 pm

Try this
Code: Select all
if(('[..\..\Fab Location]' = '[..\Location]') and ('[..\Stock Type]' = 'Purchased')) then
result := [..] * [Typical Takeoff Qty]
else
Result := 0                                                         <-- if property type is set to number else it would be '0' if it is set to text (string)


From your example above.... I am not sure where [..] is going but make sure that it is set to and producing a number (the property type is set to a number and it is at least resulting to a 0.00)
BET
SuperSwift
 
Posts: 672
Joined: Mon Jan 07, 2008 11:21 am

Re: Formula using 'Else' or 'Or'

Postby BET » Tue Mar 13, 2012 4:42 pm

Try this
Code: Select all
if(('[..\..\Fab Location]' = '[..\Location]') and ('[..\Stock Type]' = 'Purchased')) then
result := [..] * [Typical Takeoff Qty]
else
Result := 0                                                         <-- if property type is set to number else it would be '0' if it is set to text (string)


From your example above.... I am not sure where [..] is going but make sure that it is set to and producing a number (the property type is set to a number and it is at least resulting to a 0.00)
BET
SuperSwift
 
Posts: 672
Joined: Mon Jan 07, 2008 11:21 am

Re: Formula using 'Else' or 'Or'

Postby CSG99 » Wed Mar 14, 2012 5:46 am

I Can't use 'and', I need the result to be 0 if the locaions equal OR if the stock type is equal to purchased. Is this possibly with Pascal or Basic?
CSG99
PowerSwift
 
Posts: 92
Joined: Mon Jun 20, 2011 1:30 pm

Re: Formula using 'Else' or 'Or'

Postby BET » Wed Mar 14, 2012 9:28 am

Yes, sorry I was a bit tired when I posted this yesterday.
the cold below basically states that if your fab location = location or stock type is purchased then the result would be zero using the "or" operator

Code: Select all
if(('[..\..\Fab Location]' = '[..\Location]') or ('[..\Stock Type]' = 'Purchased')) then
result := 0
else
Result := [..] * [Typical Takeoff Qty]


From your example above.... I am not sure where [..] is going but make sure that it is set to and producing a number (the property type is set to a number and it is at least resulting to a 0.00)
BET
SuperSwift
 
Posts: 672
Joined: Mon Jan 07, 2008 11:21 am

Re: Formula using 'Else' or 'Or'

Postby BET » Wed Mar 14, 2012 9:28 am

Yes, sorry I was a bit tired when I posted this yesterday.
the cold below basically states that if your fab location = location or stock type is purchased then the result would be zero using the "or" operator

Code: Select all
if(('[..\..\Fab Location]' = '[..\Location]') or ('[..\Stock Type]' = 'Purchased')) then
result := 0
else
Result := [..] * [Typical Takeoff Qty]


From your example above.... I am not sure where [..] is going but make sure that it is set to and producing a number (the property type is set to a number and it is at least resulting to a 0.00)
BET
SuperSwift
 
Posts: 672
Joined: Mon Jan 07, 2008 11:21 am

Re: Formula using 'Else' or 'Or'

Postby CSG99 » Wed Mar 14, 2012 12:49 pm

That was it. Thanks.
I forgot to encase the statement in parentheses :(
CSG99
PowerSwift
 
Posts: 92
Joined: Mon Jun 20, 2011 1:30 pm

Re: Formula using 'Else' or 'Or'

Postby SwiftBB » Wed Mar 14, 2012 12:52 pm

Thanks for posting.
SwiftBB
PlanSwift Support
PlanSwift Support
 
Posts: 423
Joined: Fri Jun 17, 2011 7:35 am


Return to General Support Forum

Who is online

Users browsing this forum: No registered users and 2 guests