Skip 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.

If statement won't read variable correctly

Featured Replies

I have rewritten this code several different ways but the if statement will not recognize the value in $RefStatus.  What am I missing?

Even though the Data Viewer shows that the value of $RefStatus = 1, the statement evaluates as false.

DataViewer.png

script.png

Edited by Gerry
uploaded images

Did you debug it and when it goes to that step it skips it or does your script bail before it gets there? 

 

Your script/script step may be corrupted, too.

Have you tried playing around and saying if 1 = 1? That's usually a good test. 

  • Author

When I debug it, it skips the step.  If I use a different test, no problem.

I also tried deleting the IF statement and recreating, still same result.

32 minutes ago, Gerry said:

What am I missing?

We cannot answer that, because we don't know (a) what the function vLookup() does, and (b) what are the contents of the parameters supplied to the function.

Note that it's enough for the variable to contain a trailing space in order to be not equal to 1 (assuming it's defined as text).

 

Edited by comment

  • Author

Issue Resolved:  the vlookup function was causing a problem.  Vlookup was posted on the Brian Dunning site and works great with text results, but seems to have issues with numeric values.  Thanks for the feedback.

You could try wrapping it around with GetAsNumber.  

Yes.

If [ getAsNumber( $refstatus) = 1 ]

  • Author

Thanks Agnes,  I passed the value as a parameter to the script and removed the vlookup function.  That resolved the issue.

There are a lot of great functions on that siege. Some of them have bitten me in the behind before. So test the hell out of them before putting them in production unless it's one you've used before.

Recommend getting Clip Manager to save the ones that work for you. I have an entire library of scripts and functions that Inreuse.


Sent from my iPad using Tapatalk HD

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

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.