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.

script explodes!

Featured Replies

I'm perplexed by the action of one of my scripts and I can't figure out the problem. Here's what I've got:

Set Error Capture (on)

If [isEmpty(field2)]

Copy [donor id FM]

Perform external script

End If

If [not IsEmpty(field2)]

show message (with choices for each of the 3 buttons)

End If

If [status(CurrentMessageChoice)=3]

copy [donor id FM]

Perform external script

End If

If [status(CurrentMessageChoice)=2]

Copy [donor id FM2]

perform external script

End If

****Note that everything works just fine up until this point when I run this part only. Now the trouble starts when the script continues:

If [status(CurrentMessageChoice)=1

Copy [donor id FM3]

perform external script

End If

When I add in this last message choice, for some reason the script goes haywire and jumps back to the starting page where the script begins, instead of going to the page which is instructed in the external acript. What am I missing here? It's weird that it only happens when the 3rd choice is added on.

If you want your external script to stay in the related file, you should add a Refresh [ bring to front ] at the end of the external script.

BTW, what exactly are you "Copying"

I'm not 100% sure of this (which means that I probably shouldn't speak grin.gif), but I think you will have to give the last control to the related db. For example the end if is the last step in the script, so it will go back to the main db.

But Ugo is right - a refresh window or go to layout script in the related db can be called at the absolute end of your main script.

Could someone verify?

Ken

Your script needs to be structured this way to work properly:

If [status(CurrentMessageChoice)=3]

.. copy [donor id FM]

.. Perform external script

Else

.. If [status(CurrentMessageChoice)=2]

.. .. Copy [donor id FM2]

.. .. perform external script

.. Else

.. .. Copy [donor id FM3]

.. .. perform external script

.. End If

End If

Also, if it happens to be the same external script, you can just put that step after the last If(), instead of putting it in there three times. Redundancy is bad bad bad.

BTW, experienced developers tend to shun copy/paste wherever possible, because e.g. it requires you to go to a particular field-layout-file, and it blows away the clipboard which may annoy your users. Instead, consider using Set Field (related::global field, donor id) to move your data around.

Good points Fitch. I was going to mention the script structure, but I got lazy.

Plus, I think that it should be more like this:

If [this is true]

do this

else

If [this is true]

Show Message

If [status(CurrentMessageChoice) = 1]

do this

and so on...

end if

end if

... as many end ifs as you need

Perform script [external] - this would be the refresh window or go to layout script in the related db.

But my scripts aren't the cleanest. But he said that it works (but does it really?? cool.gif)

  • Author

As usual, Fitch nails it again. I just removed the redundant script commands (going to the external script in every If step) and now all is well. Thanks ever so much for your help.

(By the way, I already had the Refresh Window built into the tail end of the external script and that didn't make a difference.)

Now I have learned my redundancy lesson redundancy lesson.

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.