2024-08-04T18:10:41 Status: #blog #moc Tags: #altova #mobiletogether #development #softwaredevelopment #xquery #xpath #sql Links: [[Altova]] | [[MobileTogether]] | [[Mobile App Development]] | [[Software Development]] | [[XQuery]] | [[SQL]] | [[Standards]] | [[App Simulator]] | [[App Tester]] | [[App Debugger]] # ActionTrees Visual Programming Language ## Overview of ActionTrees ActionTrees is the visual [[Standards#Programming Languages Standards|programming language]] used in Altova's [[MobileTogether]] platform, designed to empower developers and non-developers alike to [[Mobile App Development|create sophisticated mobile applications]] with ease. With ActionTrees, users can visually define the logic of their applications by arranging actions in a tree-like structure. This approach provides a clear and intuitive way to design workflows and automate processes without the need for traditional coding. ![[ActionTreeEditor.png]] The visual ActionTree editor (pictured above) contains all available actions on the left side (in convenient groups that can be expanded/collapsed at will and can also be filtered by a search field above), and the tree control in the central pane. On the right side are all available Action Groups that you may have previously defined, which are essentially functions that can be reused as needed. MobileTogether's ActionTrees provide a robust and flexible environment for developing mobile apps that can [connect to databases](https://www.altova.com/mobiletogether/enterprise-apps#sources), perform computations, manage data, and more. Each ActionTree consists of a series of actions that are executed in a sequence or conditionally, based on user-defined criteria. The available control-flow options include: loops, switch statements, If-Then-Else conditionals, as well as Try/Catch/Throw exception handling. This visual programming paradigm is particularly beneficial for building complex applications quickly, as it simplifies the development process by providing a drag-and-drop interface for defining both business logic and event handlers. ### XPath/XQuery Expressions For any data manipulation that is required within the individual actions in the tree, the well-known [[XPath]]/[[XQuery]] expression language is used, providing unparalleled flexibility in manipulating hierarchical as well as tabular data structures and having an [extensive function library](https://www.altova.com/xpath-xquery-reference) that allows you to build data analytics and AI applications easily: ![[ActionTreeParsingExample.png]] And these XPath/XQuery expressions are by no means a black box. You can use the [built-in XPath Debugger](https://www.altova.com/manual/MobileTogether/mobiletogetherdesigner/mtddebugger_xpath.html) to single-step into the execution of these expression, when you are debugging your applications. ### Key Benefits of ActionTrees: - **Intuitive Visual Design**: Drag-and-drop interface to create logical sequences. - **Conditional Logic**: Support for [If-Then-Else](https://www.altova.com/manual/MobileTogether/mobiletogetherdesigner/mtdactions_ifloop_ifthenelse.html) and [Switch-Case](https://www.altova.com/manual/MobileTogether/mobiletogetherdesigner/mtdactions_ifloop_switchcase.html) constructs to handle complex decision-making. - **Advanced Control-Flow** Utilize classic [Loop](https://www.altova.com/manual/MobileTogether/mobiletogetherdesigner/mtdactions_ifloop_loop.html) structures as well as sophisticated [Try/Catch/Throw exception handling](https://www.altova.com/manual/MobileTogether/mobiletogetherdesigner/mtdactions_ifloop_trycatchexcpns.html) to control the flow of the program execution. - **Reusable Components**: Create reusable [Action Groups](https://www.altova.com/manual/MobileTogether/mobiletogetherdesigner/mtdactions_groups.html) to streamline repetitive tasks, akin to how functions are used in traditional programming languages. - **Rich Data Operations**: Integrate seamlessly with databases and web services to manipulate data effectively using [[XPath]]/[[XQuery]] expressions. - **Built-in Debugger**: MobileTogether Designer includes a [built-in Actions Debugger](https://www.altova.com/manual/MobileTogether/mobiletogetherdesigner/mtddebugger_actions.html) that supports breakpoints and gives you detailed insight into the program execution using call stack, watches, and variables display panes - **Cross-Platform Deployment**: Design once and deploy across multiple platforms, including iOS, Android, and Windows, without having to code for any specific platform. ## Detailed Explanation of ActionTree Actions We'll cover the most important actions here to give you an overview, but for the full details, please refer to the manual that includes a [reference of every single action currently available](https://www.altova.com/manual/MobileTogether/mobiletogetherdesigner/mtdactions_ui.html). ### 1. Data Manipulation Actions ActionTrees offer a suite of actions to manage and [update data](https://www.altova.com/manual/MobileTogether/mobiletogetherdesigner/mtdactions_update.html) efficiently. These actions are essential for applications that require dynamic data handling and transformation. - **Append Node(s)**: [Add new nodes](https://www.altova.com/manual/MobileTogether/mobiletogetherdesigner/mtdactions_update_appendnode.html) to an existing XML structure or database. This is useful for dynamically building data sets or extending existing records. - **Delete Node(s)**: [Remove nodes](https://www.altova.com/manual/MobileTogether/mobiletogetherdesigner/mtdactions_update_deletenode.html) from an XML structure or database. This action is crucial for maintaining data integrity by allowing unwanted or obsolete data to be purged easily. - **Insert Node(s)**: [Insert nodes](https://www.altova.com/manual/MobileTogether/mobiletogetherdesigner/mtdactions_update_insertnode.html) at a specific position within an XML structure, enabling precise control over data organization. - **Replace Node(s)**: [Replace existing nodes](https://www.altova.com/manual/MobileTogether/mobiletogetherdesigner/mtdactions_update_replacenode.html) with new data, facilitating the update of records with new information. - **Update Node(s)**: [Modify the values of existing nodes](https://www.altova.com/manual/MobileTogether/mobiletogetherdesigner/mtdactions_update_updatenode.html) without altering their structure, ensuring that data remains current and accurate. ### 2. Control Flow Actions These actions [manage the flow of execution](https://www.altova.com/manual/MobileTogether/mobiletogetherdesigner/mtdactions_ifloop.html) within an ActionTree, allowing developers to define complex logic and decision-making processes. - **[If-Then](https://www.altova.com/manual/MobileTogether/mobiletogetherdesigner/mtdactions_ifloop_ifthen.html)**: Executes a set of actions if a specified condition is true. - **[If-Then-Else](https://www.altova.com/manual/MobileTogether/mobiletogetherdesigner/mtdactions_ifloop_ifthenelse.html)**: Provides an alternative set of actions if the specified condition is false. - **[Switch, Case](https://www.altova.com/manual/MobileTogether/mobiletogetherdesigner/mtdactions_ifloop_switchcase.html)**: Allows multiple conditions to be evaluated, with actions executed based on the matching case. This is ideal for handling multi-way branching. - **[Loop](https://www.altova.com/manual/MobileTogether/mobiletogetherdesigner/mtdactions_ifloop_loop.html)**: Repeatedly executes a set of actions while a condition remains true, enabling iteration over data sets or repetitive tasks. - **[Break Loop](https://www.altova.com/manual/MobileTogether/mobiletogetherdesigner/mtdactions_ifloop_breakloop.html)**: Terminates a loop prematurely if a certain condition is met. ### 3. Execution Actions These actions are responsible for initiating, controlling, and managing the [execution](https://www.altova.com/manual/MobileTogether/mobiletogetherdesigner/mtdactions_execution.html) of tasks within an application. - **[Cancel Action Execution](https://www.altova.com/manual/MobileTogether/mobiletogetherdesigner/mtdactions_execution_cancelaction.html)**: Stops the execution of an ongoing action, useful for error handling or user cancellations. - **[Execute at Once](https://www.altova.com/manual/MobileTogether/mobiletogetherdesigner/mtdactions_execution_executeatonce.html)**: Initiates an action or set of actions immediately, regardless of the current execution context. - **[Solution Execution](https://www.altova.com/manual/MobileTogether/mobiletogetherdesigner/mtdactions_execution_solutionexecution.html)**: Allows you to cancel a solution, leave it suspended (that is, running in the background), or restart a solution. ### 4. User Interface Actions ActionTrees can also control and modify [user interactions](https://www.altova.com/manual/MobileTogether/mobiletogetherdesigner/mtdactions_ui.html), allowing developers to create interactive and dynamic applications. - **Show Message Box**: Displays a [Message Box ](https://www.altova.com/manual/MobileTogether/mobiletogetherdesigner/mtdactions_ui_msgbox.html)to the user, often used for notifications or confirmations. - **Navigate to Page**: Directs the user to a [different page](https://www.altova.com/manual/MobileTogether/mobiletogetherdesigner/mtdactions_page_gotopage.html) within the application, enabling multi-page applications and workflows. - **Set Control Property**: Dynamically changes the properties of UI controls, such as visibility or style. - **Access Calendar**: Build mobile apps that integrate can [access the built-in Calendar](https://www.altova.com/manual/MobileTogether/mobiletogetherdesigner/mtdactions_ui_accesscalendar.html) on your phone and Read as well as Write Calendar Events. - **Make Phone Call**: Directly [initiate phone calls](https://www.altova.com/manual/MobileTogether/mobiletogetherdesigner/mtdactions_ui_makecall.html) from your [[Enterprise Solutions]]. - **Send Email/SMS**: For complete business workflows you can [send emails](https://www.altova.com/manual/MobileTogether/mobiletogetherdesigner/mtdactions_ui_sendemail.html) as well as [send SMS text messages](https://www.altova.com/manual/MobileTogether/mobiletogetherdesigner/mtdactions_ui_sendsms.html) from your apps. - **Open URL**: You can [Open URLs](https://www.altova.com/manual/MobileTogether/mobiletogetherdesigner/mtdactions_ui_openurlfile.html) with the phone's browser as well as open files with external apps on the device. - **Print**: Utilize sophisticated stylesheets and the [[MobileTogether]] integration with [[StyleVision]] Server to render your data into PDF documents that can subsequently been [sent to a printer](https://www.altova.com/manual/MobileTogether/mobiletogetherdesigner/mtdactions_ui_printto.html). - **Read Contacts**: Lets you [access the built-in Contacts](https://www.altova.com/manual/MobileTogether/mobiletogetherdesigner/mtdactions_ui_readcontacts.html) in your phone to either read one specific contact's details, or load names, emails, phone numbers, and more from all your contacts. ### 5. Database Actions [Database actions](https://www.altova.com/manual/MobileTogether/mobiletogetherdesigner/mtdactions_db.html) are vital for applications that require persistent data storage and retrieval. - **DB Execute**: [Executes a query](https://www.altova.com/manual/MobileTogether/mobiletogetherdesigner/mtdactions_db_execute.html) against a database and retrieves results, which can then be used within the application. - **[DB Bulk Insert](https://www.altova.com/manual/MobileTogether/mobiletogetherdesigner/mtdactions_db_bulkinsert.html)**: Adds large numbers of new records to a database table, crucial for data entry applications. - **DB Transactions**: Allow you to implement transaction handling - especially when working with SQL Servers, including [Begin Transaction](https://www.altova.com/manual/MobileTogether/mobiletogetherdesigner/mtdactions_db_begintrans.html), [Commit Transaction](https://www.altova.com/manual/MobileTogether/mobiletogetherdesigner/mtdactions_db_committrans.html), and [Rollback Transaction](https://www.altova.com/manual/MobileTogether/mobiletogetherdesigner/mtdactions_db_rollbacktrans.html). ### 6. Web Service Actions These actions allow [integration with external web services](https://www.altova.com/manual/MobileTogether/mobiletogetherdesigner/mtdactions_soaprest.html), enabling applications to consume data from or send data to third-party APIs. - **[SOAP Request](https://www.altova.com/manual/MobileTogether/mobiletogetherdesigner/mtdactions_soaprest_executesoap.html)**: Invokes a SOAP web service and handles the returned data, supporting legacy systems and services. - **[REST Request](https://www.altova.com/manual/MobileTogether/mobiletogetherdesigner/mtdactions_soaprest_executerest.html)**: Communicates with RESTful services, which are commonly used in modern web applications. - **[Execute FlowForce Job](https://www.altova.com/manual/MobileTogether/mobiletogetherdesigner/mtdactions_soaprest_executeflowforcejob.html)**: Allows you to execute jobs on [[FlowForce]] Server as part of your application back-end. - **[MapForce Transfer](https://www.altova.com/manual/MobileTogether/mobiletogetherdesigner/mtdactions_soaprest_mapforcetransfer.html)**: The [[MapForce]] Transfer action enables one set of data structures to be converted (mapped) to a second set of data structures. Each data structure of the output set can be written to a file or to a node of a page source. ### 7. Action Groups [Action Groups](https://www.altova.com/manual/MobileTogether/mobiletogetherdesigner/mtdactions_groups.html) in MobileTogether are collections of actions that can be reused across different parts of an application. This feature promotes efficiency and consistency by allowing developers to define a group of actions once and apply them wherever needed. - **[Managing Action Groups](https://www.altova.com/manual/MobileTogether/mobiletogetherdesigner/mtdactions_groups_managing.html)**: Organize and control the scope of action groups for easy management and reuse. - **[Action Groups for Reusing Actions](https://www.altova.com/manual/MobileTogether/mobiletogetherdesigner/mtdactions_groups_reuse.html)**: Allows developers to encapsulate common tasks and use them across multiple applications or parts of the same application. - **[Action Groups with Parameters](https://www.altova.com/manual/MobileTogether/mobiletogetherdesigner/mtdactions_groups_params.html)**: Support parameterization to make action groups more dynamic and flexible, adapting to different contexts. [[MobileTogether]]'s ActionTrees offer a powerful and intuitive way to [[Mobile App Development|develop mobile applications]] with complex logic and data handling capabilities. By leveraging a visual programming approach, developers can create robust, feature-rich applications efficiently and effectively, minimizing the need for traditional coding. Whether you are building data-driven apps, integrating with web services, or designing interactive user interfaces, ActionTrees provide the tools necessary to bring your vision to life. --- # References - [[MobileTogether]] - [[Mobile App Development]] - [[App Simulator]] - [[App Tester]] - [[App Debugger]] - https://www.altova.com/mobiletogether/app-development#action-trees - https://www.altova.com/mobiletogether/low-code-app-development#action-trees - https://www.altova.com/mobiletogether/enterprise-apps#action-trees - https://www.altova.com/manual/MobileTogether/mobiletogetherdesigner/mtdactions.html