Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

What's wrong with my if/else if script ?

Featured Replies

I have done that script to make sure the appropriate invoice is created and that the invoice will go in the right folder but it doesn't seem to work.

When I click on the button, only the If/Else with SP72, SP144, SP216 seem to be working but not the H125, etc...ones...

What am i doing wrong ?

... Once one If / Else If evaluates to true, the if statement is considered completed so it exits it... If you want ALL of them to evaluate:

If[condition 1 ]

#Do X

End If

If[condition 2 ]

#Do Y

End If

If conditions 1 and 2 are both true above, both X and Y will be done

If[condition 1 ]

#Do X

Else If[condition 2 ]

#Do Y

End If

If conditinos 1 and 2 are both true above, only X will be done -- FM doesn't care about condition 2 because condition 1 evaluated to true..

  • Author

So pretty much, I have to change all the else if by If and make sure the End If is there for each of the If ...right ? ;-)

  • Author

I really don't get it...there are 2 main things in my if...the meanTocommunicate (EMAIL,POST,FAX) and the packageID (SP72,SP144,SP216,H125,H1210, etc...) that will create a different document. Why doesn't it work.

my script is:

If[condition 1]

#Do A

Else If[condition 2]

#Do B

Else If[condition 3]

#Do C

Else If[condition 4]

#Do D

Else If[condition 5]

#Do E

Else If[condition 6]

#Do F

End If

The conditions are really distinct so condition 1 cannot really be confused with another one so on and so forth.

If all along, condition 1, 2,3,4,5 are not validated... only condition 6 should happen...right ?

What is wrong in my script?

  • Author

By the way, I just tried the

If

End if

thing but it doesn't work

Else If[ ] should work fine. However, your syntax for determining the packageID is incorrect. Instead of:

PackageID = "a" or "b"

you need to use:

PackageID = "a" or PackageID = "b"

It seems you could also streamline this a bit, by grouping all the common steps and placing them outside the If structure, e.g.

If [ POST ]

# common stuff for POST

If [ Package type A ]

# stuff for type A

Else If [ Package type B ]

# stuff for type B

End If [ ]

# more common stuff for POST

Else If [ FAX ]

# common stuff for FAX

If [ Package type A ]

...

  • Author

IT's working.

Thanks a lot...problems came from the syntax.

CHEERS !!!

Sorry, Looks like I made up a question to solve my self

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.