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.

Help on alert of error

Featured Replies

Hello

I have a FMP solution I did under FMP12 using some scripts from Scriptmaster ; everything runs fine !

Opening this solution in FMP14 Adv when one FM script using SM is executed I get a warning window I join a screen copy. I precise that after that the FM script runs fine till its end.

I don't understand at all what is said and don't know in what direction I must search to avoid this alert.

Thank for your help !

Noël

Capture d'écran 2020-04-18 14.25.25.png

post the code Noel.....

it is to do with the way Groovy 'guesses' or overloads methods based on what it thinks you are working with

So for example if you pass 2 in a function it will guess this is an integer number but if you pass 2.5 it will assume it is the decimal type -both of which are different, and if you pass "2" it will assume this is a string

Somewhere a null value is being used and the code is not trapping for this as an error, neither does Groovy know what to do with that as it could do multiple things.

This is due to a change of Java I think.

  • Author

Hello

I just run the FM script step bys step. And so I found the error : and Scriptmaster is not guilty; it was on CopyFile (src; dest) that the alert occurred. Here is the code

RegisterGroovy( "CopyFile( src ; dest )" ; "InputStream input = new BufferedInputStream(new FileInputStream(src));¶
OutputStream out = new BufferedOutputStream(new FileOutputStream(dest));¶
try {¶
	out << input;¶
} finally {¶
	if (out != null) out.close();¶
	if (input != null) input.close();¶
}"; "isGui=false" )

The error was in the definition of the paths for MacOS only ! Sorry to have disturbed uselessly !
Keep yourself healthy!

Noël

 

Edited by Noél Dubau

Thanks Noel

 

To stop this happening again either do an explicit test for a null input path, or add a catch (e) at the then of your code

 

Try{

//code

} finally {

//code

} catch (e) {

//return a logical error message]

}

 

  • 9 months later...
  • Author

Hello John

Many things occured in my life and took me far from FileMaker all the year long.

I don't understand what code I must include and how ; would you be kind to help me more ?

Noël

this???

 

//src = input path
//dest = output path


input = new BufferedInputStream(new FileInputStream(src))
out = new BufferedOutputStream(new FileOutputStream(dest))
try {
	out << input
} finally {
	if (out != null) {out.close()}
	if (input != null) {input.close()}
} catch (e) {
	return e.getMessage()
}

 

  • Author

Sorry but always disturbed by problems...

I have not the script before registering the function... and don't know how to include the code you give ...

and that error box occurs in many sm functions

 

The error message says

I have this result (null) but there are several possibilities for what kind of object you mean and so I can't make any guess what you really need here, because if I guess wrong then the next thing might fail.

If you use a try { } notation then anything that goes wrong in the code in the middle you will get an error. If you tell the code to deal with it then you are in charge of what is returned - this is just the same as in FileMaker when you turn on error capture

 

The code needs to look like 

try { do something.... } catch (anyerror) { do something with the error }

 

because of how Groovy is written then all this gets simplified to the code I shared

try {

something 

} catch (e) {
// give back a result with the message part of the error
return e.getMessage()
}

 

Create an account or sign in to comment

Important Information

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

Account

Navigation

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.