Qodly is a groundbreaking hybrid low-code application development platform that redefines how you build applications. With Qodly, you'll find yourself needing only a minimal amount of code, and sometimes, no code at all. It's as simple as designing your application, and Qodly Studio takes care of generating all the necessary code on your behalf.
While Qodly empowers you with its low-code capabilities, there are situations where coding expertise becomes essential. Within Qodly Studio, you'll harness the power of events in combination with class functions to effectively manage the intricacies of your web application.
In QodlyScript, you can structure your code using two fundamental constructs: methods and classes.
Methods are isolated blocks of code that serve various functions within your application. They can be invoked from class functions or other methods but cannot be directly accessed from components.
Classes allow you to organize your code around objects. Only class functions can be accessed from components. Qodly offers two main types of classes:
User Classes: Used for controlling component behavior, such as displaying or hiding components in response to events using the 4D.WebFormItem class functions.
ORDA Classes: Employed to configure data models and implement business logic.
Each method and each class is stored in its own QodlyScript file (.4qs):
<methodName>.4qs for methods and
<className>.4qs for classes.
Method and Function Management
When working with methods and classes in Qodly, it's essential to understand how to create, duplicate, rename, and delete them. Here's how you can effectively manage these aspects:
You can create a method or class using one of the three methods:
- You can create them individually from dedicated grids on the Qodly Studio Homepage.
- In the Explorer, simply click the plus icon located next to either
- While in the Webform Editor, go to the
New +tab and opt for either
UntitledNappears in the list, where N is a number incrementing with each new creation. You can provide a compliant name and press Enter to confirm the modification.
To rename a method or class, you can either:
- Click on the icon at the right side of the item in the Explorer.
- Or, in the tab pop-up menu, select
Rename. The tab name becomes editable, and you can give it a compliant name.
Deleting a method or class is straightforward:
- In the Explorer, open the options menu for the item you wish to delete.
- Confirm the deletion in the subsequent warning dialog.
To close a tab, either click the
xbutton or use the tab's pop-up menu
For testing purposes, a method can be executed from the Explorer
Or directly from the toolbar
For comprehensive information on debugging your code, please refer to the Debugger section.
Code Preservation and Synchronization
Ensure the integrity and consistency of your method and class code in Qodly with these preservation and synchronization tools.
Your code modifications are automatically saved at regular intervals. However, if you want to ensure immediate saving, you can click
Save all to save all edited tabs.
To fetch the latest version, right-click the tab and choose
Reload. This action initiates an immediate refresh of the code content directly from the server, ensuring that you are always working with the latest code, even if you haven't made any local edits.
Collaborative Editing Behavior
Methods and class functions in Qodly Studio feature real-time synchronization when multiple users are editing the same class function. These collaborative editing capabilities are accompanied by safeguards to prevent data loss in specific scenarios. Here's how it works:
Automatic Synchronization: Whenever a user edits and saves a method or class function, those changes are instantly synchronized across all open tabs where other users are working on the same class function. This guarantees that every user has access to the most current version of the code.
Unsaved Changes and "Outdated" Status: Consider the scenario where
User Amakes changes to a method or class function but neglects to save them, and then
User B, who is also working on the same method or class function, makes different changes and saves them. In this scenario,
User A's method or class function tab, which contains unsaved changes, will recognize that it now holds outdated content compared to the version saved by
User B. This recognition is indicated by an
Page Refresh and Data Persistence: Qodly Studio employs client-side data persistence through the browser's local storage to store and retrieve the state information. When
User Ainitiates a page refresh, the following actions are performed:
Checking Local Storage: Qodly Studio checks the local storage for any saved state data associated with the tab that
User Awas working on.
Retrieving Saved Data: Upon discovery, Qodly Studio retrieves this stored data, which includes the current content of the method or class function that
User Awas editing.
Assessing the "Outdated" Status: Additionally, the application assesses the
outdatedstatus based on an attribute within the tab state flags section. This attribute serves as an indicator of whether the current state is outdated compared to the version stored on the server.
These measures ensure that even after a page refresh,
User Aremains fully informed about any changes made by others, such as
User B, while preserving their own unsaved changes.
- Reload Option: Within the method/class tab of Qodly Studio, you'll find the Reload feature. Upon selecting this option, a confirmation message will promptly appear, indicating that your local changes will be lost. Should
User Achoose to reload the content will trigger an immediate refresh of the code content directly from the server.
- Save all: Should
User Achoose to save the outdated code in their tab, a confirmation message will appear, alerting them to the presence of new content saved by
User B. This serves as a safeguard to prevent unintentional overwriting of more recent changes made by different users.
- Data Loss Prevention: If
User Aproceeds to save the outdated code, the changes made in their tab become the current version, potentially overwriting
User B's changes.
This collaborative editing behavior aligns with common practices in collaborative environments, offering users flexibility while minimizing the risk of data loss or conflicts during concurrent edits.
Qodly Studio relies on the Language Server Protocol (LSP technology) to offer advanced coding features like code completion and syntax highlighting.
Reloading is recommended in cases where a connection is not established. Without this connection, while you can still write and save your code, you will miss out on LSP-related features.
The Qodly Studio code editor includes helpful type-ahead and auto-completion features. You can easily incorporate these suggestions into your code using the following methods:
- The suggestion list automatically appears as you start typing.
- To insert the selected suggestion, simply press the
- At any point, you can manually trigger the suggestion list by pressing
Ctrl + Space bar.
When a QodlyScript command or function is entered in the code editor, you can get documentation on this command or function by hovering the cursor over the command or function name:
- a tooltip appears, displaying the parameters of the command or function along with a short description;
- you can also click on the Show documentation link within the tip, which opens the complete documentation for the command or function on developer.qodly.com in your browser.
The Command Palette offers easy access to all available commands in the code editor, including any associated shortcuts. You can open it by right-clicking in the code editor window or pressing
The palette includes a filtering option to find specific commands quickly.