Jump to content

Is "SCSetErrorCapture" still present in version 3.03


Recommended Posts

I see documentation about the function "SCSetErrorCapture"

http://static.360works.com/plugins/SuperContainer/plugin-documentation.html#SCSetErrorCapture

but that is the "SuperContainer Companion Plugin 2.9515 User Guide", and I have Version 3.03 (7/18/2023) running now.

In FileMaker Pro 19.6.3 on a Mac, with SuperContainer Companion Plugin 3.03, I'm not seeing the SCSetErrorCapture function available in Script Workspace.

Link to comment
Share on other sites

Maybe I found part of my own answer, by re-reading the SC Companion Plugin User Guide more carefully —

Quote

NOTE:This will only suppress error dialogs when plugin functions are called as part of a calculation. If you are calling plugin functions as script steps ( available in FM 16+) then you will need to use the native FileMaker function Set Error Capture On/Off

So that explains why I did not see "SCSetErrorCapture" listed as a standalone script step function that I could call directly in FMP 19.

And now I *DO* see "SCSetErrorCapture" listed as a Step in Script Workspace, but only when I'm in the "Specify Calculation" window of a script step that calls a SC plugin function (in my case, both SCSetContainer and SCChooseFile). So SCSetErrorCapture is still present in this version. Good!

But I'm unclear how to use SCSetErrorCapture within that calculation.

I want to suppress SC error dialogs if SCSetContainer fails. I have a Set Variable script step to set $result to the following calculation:

Quote

SCSetContainer ( Container::ResourceIdentifier_c ; SCChooseFile ( "" ; "" ; "Choose the file to attach now." ) )

But where and how do I use SCSetErrorCapture to suppress the inevitable SC error dialogs that appear if the user cancels the upload? (Adding the FileMaker native script step "Set Error Capture (On)" before the Set Variable above does not suppress the SC error dialogs.) Where in this calculation does it belong? Thanks.

Link to comment
Share on other sites

Hi David,

 

You wouldn't call SCSetErrorCapture within the calculation for SCSetContainer.  SCSetErrorCapture would be called within its own script step, in this case as the value of a Set Variable script step. This can be called at the beginning of your script or even in a script that runs at start up. Here is an example:

Set Variable[$errCap; Value: SCSetErrorCapture(True) ]

Set Variable[$setContainer; Value: SCSetContainer ( Container::ResourceIdentifier_c ; someTable::someContainer)

if[$setContainer = "ERROR")

//Do something here to handle the error

End If

To clarify, if you were to call SCSetContainer as it is own script step (i.e. not within the calculation for a Set Variable script step) then SCSetErrorCapture will not suppress error messages from the plugin. In that case, you need to use the native FileMaker function Set Error Capture On/Off .

 

Please let me know if you have any questions!

Link to comment
Share on other sites

Thanks, Ryan! Your suggestion worked.

Yes, using a Set Variable in order to call SCSetErrorCapture does work to suppress any SC error messages – but it's still mysterious to me how setting a variable that you don't actually need to use anywhere later is the approach that is necessary. But I'm always learning more about plugins! This works!

I appreciate your rapid response.

Link to comment
Share on other sites

Hi David,

Glad you got it sorted!

 

19 hours ago, David Hollander said:

but it's still mysterious to me how setting a variable that you don't actually need to use anywhere later is the approach that is necessary

It doesn't necessarily have to be in a Set Variable script step, just within a calculation. Set Variable is the easiest way to do it. Another reason to use Set Variable is that value of that variable gets set to the result of the plugin function. You can then use that variable in different ways depending on what you are doing. One way is for error checking as seen in my example in my last post:

if[$setContainer = "ERROR")

When called as calculations, all of our plugin functions will return "ERROR". You can check for that value and then handle the error as you see fit. Each plugin also has its own last error function that will give a more detailed error message. For the companion plugin that is SCGetLastError.

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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