LiveCode for FM ManualCustom ComponentsHow do I return a value to FileMaker?

How do I return a value to FileMaker?

You will often want to return data to FileMaker from your custom component. This lesson will show you how to do this.

Example Stack

This example stack will get the long time and date in LiveCode and return the value when the "Return and Close" button is clicked.

Returning a value from a custom component

To show a custom component the stack is shown using the modal command, this pops up the component in a modal window. Any code that comes after the modal command is executed after the stack is closed.

To return a value to FileMaker you use the return control structure.

Note: with modal stacks you must provide a way to close the stack, either through a button or other method such as automatically closing the stack when it is clicked.

Stack Script

on FileMakerLoad
   
end FileMakerLoad

on FileMakerUnload
   
end FileMakerUnload

on FileMakerAction pAction  
   put the long time && the long date into field "timeAndDate"  
   modal stack "valueReturn"
   return field "timeAndDate"
end FileMakerAction

command returnAndClose
   close this stack
end returnAndClose

Button Script

on mouseUp
   returnAndClose
end mouseUp

Importing the custom component into FileMaker

When your component is complete import it into FileMaker following the steps in this lesson.

Using the custom component in FileMaker

Once your component is imported you can get the returned value by calling the component with via the LC component.

0 Comments

Add your comment

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.