| **Navigation:**  [[clarion 7 faqs.htm|How To's and Troubleshooting]] > How to... >====== Create a Function with the Application Generator ====== | [[creating a dll sub application .htm|{{btn_prev_n.gif|Previous page}}]][[clarion 7 faqs.htm|{{btn_home_n.gif|Return to chapter overview}}]][[how to create a multi page form.htm|{{btn_next_n.gif|Next page}}]] | | || To create a function with the Application Generator, you must specify both a Prototype and a Return Value in the **Procedure Properties** dialog. The prototype must specify at least a datatype for the return value. You must specify a prototype //before// you can specify a return value. 1.In the **Prototype **field in the **Procedure Properties** dialog, type the following prototype: **(),LONG** This specifies no parameters and a return datatype of LONG. The datatype may be any valid Clarion language datatype. 2.Press the **Actions** button to open the **Procedure Properties** sub-dialog. This enables the **Return Value **field. 3.In the **Return Value **field, press the ellipsis button (...) to select or define a variable to receive the return value for your function. {{tipbox.jpg|TipBox.jpg}} You should embed code to assign the appropriate value to the returned variable. **Receiving Return Values from Procedures** Although you may call a function with //Call a Procedure// from the **Actions **dialog from a button or method, this method does not allow you to receive return values. Therefore, you should generally use embedded source or hand code to receive a return value from a function. Following is one way to call a function from a control; however, you may call a function in many ways. 1.Right-click on the button control, and select the **Embeds **option. 2.In the **Embedded Source **dialog, choose the //Accepted// embed point for //Control Event Handling, after generated code//, then press **Insert**. 3.In the **Select Embed Type **dialog, select SOURCE. 4.In the Text Editor, type your function call, for example: **        ValueFromFunction = MyFunction()** where //ValueFromFunction// is a local, module, or global variable that receives the value returned by the function. 5.Press the **Save and Close **button** **from the menu, then save your embedded source when prompted.