Dataset Viewer
Auto-converted to Parquet Duplicate
text
stringlengths
1
5.93k
1 Integrating 4D with Notion: Creating Pages and Databases Using the Notion API By Al Mahdi Bakkali, Quality Support Engineer, 4D Inc. Technical Note 25-08
2 Table of Contents Table of Contents ............................................................................................ 2 Abstract........................................................................................................ 3 Introduction ..............................................................
3 Abstract This technical note explores the integration of 4D, a powerful application development environment, with Notion, a modern workspace platform, using the Notion API. The guide demonstrates how to perform CRUD (Create, Read, Update, Delete) operations in Notion databases and pages programmatically from withi...
4 Notion databases can present data in the form of a table, where each entry represents a record, or a “Page” in Notion. Each page may have several attributes that the end user can input. The integration of 4D with Notion presented in this tech note can allow developers to centralize third-party data to visualize an...
5 5. Click on Save 6. In the success alert, click on “Configure integration settings” By following the step outlined above, the integration is now successfully created, and the browser has redirected to the integration settings page. This page is crucial for configuring and restricting access to the Notion API. Regis...
6 Understanding Notion API Concepts Now that the authorization token was successfully obtained, it is possible to make requests to the Notion API. The next section explores basic concepts in Notion and a selection of API endpoints to exemplify the integration of 4D. Pages vs. Database The concept of pages and databas...
7 Keeping track of the page id is also necessary, as updating existing pages will require their id. However, this id is obtained automatically in this tech note as it also serves to synchronize data entries between Notion and 4D. Managing Session Data with Storage The Storage object is a powerful tool in 4D for manag...
8 Here is a sample 4D object with the headers for the Notion API: $headers:=New object $headers.Accept:="application/json" $headers["Content-Type"]:="application/json" $headers.Authorization:="Bearer "+"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" $headers["Notion-Version"]:="2022-06-28" Creating a page To crea...
9 Reading a database Retrieving data from a Notion database is done by making a POST request to the "Query a database" endpoint: https://api.notion.com/v1/databases/{database_id}/query This endpoint allows retrieval of all the pages (or records) within a specified database. The response from this endpoint contains a c...
10 Mapping 4D Data to Notion Schema In the sample application, a collection of inventory items is worked with in 4D. Each item in the collection is an object with properties like category, dateAdded, price, productName, and stockLevel. This structure in 4D must correspond directly to the property schema in the Notio...
11 • Dealing with Common API Errors A successful API request will return a HTTP status code between 200 and 299. In 4D, this can be checked with a conditional statement like: If (($dbRequest.response.status>=200) & ($dbRequest.response.status<300)) // Successful response, Else // use $dbRequest.response.statusText ...
12 When the update button is clicked the code below is executed in 4D to update the stock levels: $newStockValue:=100 $headers:=New object $headers.Accept:="application/json" $headers["Content-Type"]:="application/json" //$headers.Authorization:="Bearer "+"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" $headers[...
13 Qodly Studio provides. The application displays key metrics such as Total Items, Total Revenue, Items Sold, and a Low Stock Alert, offering a comprehensive overview of the inventory status. Here are some instructions to get started with Qodly Studio and try the demo app: • Check Prerequisites: Before begining, ens...
14 Qodly Studio promotes code reusability by allowing developers to build web applications that can interact with the same backend business logic and data models used in their 4D applications. Although Qodly Studio uses its own scripting language, the underlying architecture ensures that data and rules defined in 4D...
1 Embedded Database Structures with Built Remote Clients By Tai Bui, Technical Services Engineer, 4D Inc. Technical Note 25-03
2 Table of Contents Table of Contents ............................................................................................2 Abstract........................................................................................................4 Introduction ................................................................
3
4 Abstract A built 4D Client-Server application provides an efficient way to deploy a 4D database application to multiple users. The compiled application ensures source code security and gives developers control over the user experience. However, a common limitation of 4D ClientServer deployment is that a 4D Remote C...
5 The database structure defines the logic and functionality of a 4D application and can be deployed in different modes and forms: Interpreted Mode – Runs directly from the source code, allowing real-time modifications and debugging. This mode can be slower as the machine must “interpret” the human written code. Thi...
6 written code cannot be executed in a built 4D client until it successfully connects to a server. To address this limitation, 4D provides a feature that allows a standalone database structure to be embedded directly into the built remote client. When a standalone database structure is embedded into the client, the c...
7 Once the build succeeds, the resulting merged 4D Server database application will function as the typical server application. The 4D Remote Client, on the other hand, will be packaged with the embedded compiled standalone structure. It’s important to note that while it’s possible to develop a single structure that...
8 reason. This can allow users a more elegant experience by allowing them to continue their work without disruption nor having an error message displayed. The goal of an embedded database is to connect to a server successfully using OPEN DATABASE allowing the 4D Remote client running a standalone database to transit...
9 Step 2: Open the Standalone Database First, open the standalone database with the standard 4D application for development. When it opens, the window should display, providing a summarized description of the database structure and the steps to perform. The code is provided in the database structure and can be viewe...
10 Image 1: Design Menu with Build Application item towards bottom. A message might display requiring the code to be compiled. Accept, if it displays, to compile the code. Step 4: Configure the Build Settings to Build Compiled Structure Make sure that the Compiled structure is generated by going to the “Compiled stru...
11 Demo Structure for Client Server Database Next, the client-server database is in the “Demo_CS” directory. Step 6: Open Client Server Database Afterwards the database can be opened in the standard 4D application for development. Similar to the “Demo_EmbeddedDB” structure, the structure should display a window summa...
12 Image 4: Build client application setting enabled with 4D Volume Desktop location specified Step 10: Generate the "buildApp.4DSettings" file Afterward, go to the bottom left and click the “Save settings” button. This will generate a “buildApp.4DSettings” file with the applied settings in the databases “Settings” ...
13 </Preferences4D> … Save the changes and then go back to the Build Wizard and perform the build without making any changes to the file from the wizard that might remove the added key. Step 12: Generate the Built Client and Server Applications Open the build wizard again and click on the “Build” button. This will gen...
14 Image 6: Settings menu items Step 17: Change the Port Number In the settings window, go to the “Client-server” section > “Network options” tab. The Port Number is defined here to be using the default 19813. Change this to another available port such as something like 19823. To prevent an error message, it is also ...
15 The directory also contains a “Resources” directory. Enter this directory and create a “Server” directory. Step 20: Create .4dlink files to Specify Servers and Priority A template for .4dlink files can be found in the Technical Note’s \Demo\templates\ directory. The template should only need the address of the ser...
16 Conclusion This Technical Note has explored the powerful feature of embedding a standalone database into a built 4D remote client, offering a robust solution for deploying 4D database applications. By embedding a compiled standalone structure directly within the client, developers can execute code without requiri...
1 Error Management and Logging in 4D Applications By Karim Meghraoui Technical Support Engineer, 4D Morocco. Technical Note 25-09
2 Table of Contents Table of Contents ............................................................................................ 2 Abstract........................................................................................................ 3 Introduction ..............................................................
3 Abstract In any complex application, various types of errors are bound to occur, from missing files and unstable network connections to unexpected bugs. These errors generally fall into several categories: syntax errors, which result from that violates the language’s rules and are typically caught at compile time,...
4 The Three Scopes of the ON ERR CALL Command 1. Local scope (ek local) The local scope makes it possible to define an error handler for a specific block of code or method. This approach provides precise and targeted control over errors that may occur in a particular part of the program. The local handler always take...
5 Practical Case: Error When Writing to a Read-Only File Consider a method that attempts to write to a file named example.txt located in the database folder. This file is deliberately set to read-only, which makes any write operation impossible and triggers an “Access Denied” error. The behavior of 4D code in this co...
6 The user is forced to make a choice (Abort, Continue, etc.), making the process dependent on manual intervention. Case 2: With ON ERR CALL("ErrorWriteDoc") In 4D, the ON ERR CALL("ErrorWriteDoc") command allows a centralized error handler to be installed. When an error occurs, the ErrorWriteDoc method is automatica...
7 $obFile.setText(JSON Stringify($colJSON; *)) //ALERT("Write Error !") This method begins by retrieving recent errors using Last errors. The most recent error is then enriched with valuable contextual information. Among these, Error method indicates the name of the method where the error occurred, Error line provid...
8 ON ERR CALL($previousErrorHandler) This line restores exactly the handler that was active initially. If none was defined beforehand, it automatically disables the handler (since the variable contains an empty string). This ensures that the code remains reliable and does not interfere with other parts of the applic...
9 Each corresponding to an error, with information such as the error number, the associated message, and the signature of the internal component that caused the error. If no error has been recorded, the command returns null
10 The stack can also contain errors explicitly generated using the throw command.
11 This command must be used in a context suitable for error handling, such as a method installed via ON ERR CALL or inside a Try or Try/Catch block. Aborting an Error Regardless of which handler is executed, the ABORT command is always effective and allows code execution to be stopped. The ABORT command is designed ...
12 Modern Error Handling in 4D Since 4D version 20 R2, the throw() command allows developers to manually generate an error at a specific point in the code. It accepts an error code and/or a custom message, and behaves like a standard 4D error: • If no handler is defined (ON ERR CALL), a dialog box is displayed. • Oth...
13 Throwing an error via an object containing properties throw(errorObj) The errorObj object allows for detailed and customized error handling. It can contain several properties: • componentSignature (text): identifies the error source with a 4-letter signature. By default, "host" for the host database or "C001", "C0...
14 It is possible to execute the command multiple times within the same method to generate multiple errors. By activating the deferred option, all these errors can be grouped and returned at once. Deferred error handling Deferred mode (deferred) allows postponing the triggering of an error until the end of a method ...
15 In this example, the Try(expression) instruction is used to attempt to open and write to a text file named example.txt. This file has been set to read-only to intentionally cause an error. The code begins with a file opening attempt encapsulated in Try. If the opening succeeds, a FileHandle object is returned. Ot...
16 capturing errors without interrupting the program but also tracing them precisely and storing them for later analysis or logging. Thus, whether using Try(expression) or Try...Catch blocks, the Last errors command remains the central element for identifying, retrieving and exploiting errors. In the first case, it ...
1 Managing Component Dependencies: Challenges and Solutions By Abir HSAINI, Technical Services Engineer, 4D Inc. Technical Note 25-06
2 Table of Contents Table of Contents ............................................................................................ 2 Abstract........................................................................................................ 3 Introduction ..............................................................
3 Abstract Managing 4D components through project dependencies can pose several challenges during development, particularly regarding version control and update consistency. These issues can lead to unexpected behavior, and integration difficulties across projects. This technical note outlines the most common problem...
4 /TheProject/Project/Sources/dependencies.json It can declare: • Local components, stored on the machine in a standard components folder. • GitHub-based components, fetched from public or private GitHub repositories. Example: { "dependencies": { "theGitHubComponent1": { "github" : "JohnSmith/theGitHubComponent1" }, ...
5 Example: { "dependencies": { "theLocalComponent1" : "theComponent1", "theLocalComponent2" : "../theComponent2", "theLocalComponent3" : "file:///Users/jean/theComponent3" "theGitHubComponent1": { "github" : "JohnSmith/theGitHubComponent1" } } } 4D looks for components in three main locations. First is the Comp...
6 The Dependencies panel in 4D displays all the dependencies used in a project, regardless of the source. Each dependency includes an origin tag beneath its name, indicating where the component was loaded from. Origin tag Description 4D Component A built-in 4D component located in the Components folder of the 4D app...
7 For a GitHub component, you must add the GitHub repository address and define a dependency rule to control how the version is resolved. This is done via the component management dialog: To declare a GitHub component, the GitHub repository address must be provided, along with a dependency rule to control version re...
8 4D’s Dependency Manager provides integrated support for checking and updating GitHub components, either automatically or manually. • Automatic checks for new versions run in the background. If a GitHub access token is provided, checks are more frequent. • Manual checks for updates: • For a single dependency: right-...
9 developer can define either a specific tag (e.g., "tag": "beta2") or a semantic version (e.g., "version": "2.1.3"). The versioning follows the Semantic Versioning format: major.minor.patch. He can also use version ranges and wildcards to define flexible dependencies. For example, "1.*" targets all versions within m...
10 Common Issues and Solutions While managing dependencies through the Dependency Manager, several issues may arise. The section aims to highlight common problems encountered in real-world projects, along with practical solutions and best practices to prevent or resolve them. Component Update Not Detected or Not Appl...
11 After verifying the latest release exists, if the error persists, it may be caused by an incorrect access token. In that case, the developer should modify the token by clicking on "Edit the GitHub personal access token" from the Dependency Manager. Component Version Changes Without Explicit Permission When the dev...
12 Create a release A release is created using the predefined tag and version, such as 1.0.3. It makes the component available for use in the 4D Dependency Manager. To respect the naming convention for 4D version tags, the release can be named 20.9.9385.
13 Add the GitHub access token To use a private GitHub repo in 4D Dependency Manager, the developer should add the GitHub personal access token by Selecting “Add a GitHub personal access token...” from the Dependency Manager. For the test , token: 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 Add dependency to the project...
14 Conclusion Managing dependencies in a 4D project especially when using external components from GitHub requires both structure and attention to detail. Throughout this note, we’ve explored how to declare dependencies using dependencies.json and environment4d.json, how to monitor and troubleshoot them using the De...
1 UDP Sockets: Peer to Peer Communication By Anouar Moustarih, Quality Support Engineer, 4D Morocco Technical Note 25-12
2 Table of Contents Table of Contents ............................................................................................ 2 Abstract........................................................................................................ 3 Introduction ..............................................................
3 Abstract The User Datagram Protocol (UDP) serves as a lightweight, connectionless transport layer protocol in the TCP/IP suite, prioritizing speed and low overhead over reliability by omitting handshakes and retransmissions. UDP suits real-time applications where occasional packet loss is acceptable, such as video...
4 Conditions that must remain satisfied while the system is running • UDP broadcast packets (destination 255.255.255.255 or the configured broadcast address) must reach all participating machines • The discovery port must remain open and unblocked for the entire lifetime of the application When these prerequisites an...
5 This.discoveryPort:=54321 End if If (OB Is defined($options; "broadcastAddress")) This.broadcastAddress:=OB Get($options; "broadcastAddress") Else This.broadcastAddress:="255.255.255.255" End if If (OB Is defined($options; "ttl")) This.peerTTL:=OB Get($options; "ttl") Else This.peerTTL:=90 End if If (OB Is defined($o...
6 CALL WORKER("p2pworker"; Formula($1._initSockets($2)); This; $socketHolder) $socketHolder.endOfInitialization.wait() This.listener:=$socketHolder.listener This.sender:=$socketHolder.sender Function _initSockets($socketHolder : Object) Use ($socketHolder) $socketHolder.listener:=4D.UDPSocket.new(This.discoveryPort; Th...
7 return End if If ($msgType="ANNOUNCE") This.addOrRefreshPeer($obj; $event.address; $event.port) Else If ($msgType="PROBE") var $json : Text $json:=JSON Stringify(This.myInfo) var $blob : Blob TEXT TO BLOB($json; $blob; UTF8 text without length) This.sender.send($blob; $event.address; $event.port) Else If ($msgTyp...
8 $info:=New shared object("type"; $peerObj.type; "id"; $id; "name"; $peerName; "port"; $peerObj.port; "version"; $peerObj.version) $entry.info:=$info End use Function removePeerById($id : Text) If ($id="") return End if var $i : Integer Use (This.peers) For ($i; 0; This.peers.length-1) If (This.peers[$i].id=$id) T...
9 This.sender.send($blob; This.broadcastAddress; This.discoveryPort) Use (This) This.logText:=This.logText+"["+String(Current time)+"] Sent BYE\n" End use Else Use (This) This.logText:=This.logText+"["+String(Current time)+"] Skipped BYE send (sender not initialized)\n" End use End if This.closingSignal:=New signal() ...
10 "ANNOUNCE", addOrRefreshPeer calls with obj, address, port. For "PROBE", myInfo sends back to sender. For "BYE", removePeerById invokes with senderId. addOrRefreshPeer The addOrRefreshPeer function updates peers. Id extracts from peerObj. Function returns if id empty. Index searches for matching id in peers. PeerN...
11 #DECLARE($options : Object) var $discovery : cs.PeerDiscovery $discovery:=cs.PeerDiscovery.new($options) Use (Storage) Storage.discovery:=$discovery // Share instance Storage.peers:=New shared collection Storage.logText:=New shared object("value"; "") End use While (Not($discovery.closingSignal.wait(5))) $discover...
12 Case of : ($diff<60) $formatted:=String(Round($diff; 1))+" seconds ago" : ($diff<3600) $formatted:=String($diff\60)+" minutes ago" : ($diff<86400) $formatted:=String($diff\3600)+" hours ago" End case The Util_formatLastSeen method declares lastSeen as Integer input and formatted as Text output. Diff calculates as m...
13 peer list accurate, graceful BYE messages prevent ghost entries, and the provided formatting method ensures clean presentation in user interfaces. This solution proves particularly valuable for distributed tools, collaborative desktop applications, local synchronization services, and any scenario requiring rapid, ...
1 Managing Email and Folders with 4D NetKit By Trina Nguyen, Technical Services Engineer, 4D Inc. Technical Note 24-13
2 Table of Contents Table of Contents ............................................................................................2 Abstract........................................................................................................3 Introduction ................................................................
3 Abstract As the Internet moves towards higher security protocols, so do the authorization systems. OAuth 2.0 was introduced as an alternate and more secure login procedure compared to the classic protocol of username and password. OAuth 2.0 utilizes tokens that take the user information from other web apps to auth...
4 Prerequisites to Using 4D NetKit Before anything, the latest version of 4D needs to be installed and a Web Application Expansion license to be able to listen for and receive tokens. The methods gone over in this tech note, as well as the attached sample database, will need a minimum version of 4D 20 R6. To begin u...
5 7. On the Edit app registra&on screen, fill out the required fields. The app domain field could be le9 blank for now. Click Save and Con&nue to move on 8. On the Scopes screen, click Save and Con&nue. AddiIonal scopes can be added later to be+er suit the applicaIon. 9. On the Test users screen, click Add Users to a...
6 12. Select Desktop app, enter in the name of the app, then click Create 13. A pop-up window should appear that displays the client ID and client secret for the applicaIon. There is the opIon to click the DOWNLOAD JSON link to save the file with the informaIon as a .json file, otherwise it can be accessed anyIme from...
7 15. Scroll down unIl the Gmail API square under Google Workspace appears. Click on it 16. Click on the blue Enable bu+on to allow this applicaIon to call on the Gmail API From here, the developer can choose to keep their application in “testing” status so that they could test out how their program would work once it...
8 Establishing Connection and Obtaining the Access Token To obtain the access token from Google and establish connection, the developer would need to start by creating the 4D NetKit OAuth2Provider object and filling it in with the client secrets obtained from the previous section. // Creates the object that contains...
9 Please note that if the app is “In Production” status by this stage but not verified, Google will send a notice screen back saying that the app would need to be verified before it will allow the connection to be made. Since the sample database is a simple test application made for demonstrative purposes, it is no...
10 Send, Receive, Delete Emails via Google Gmail API The first step in demonstrating how to use 4D NetKit with the Gmail API is through sending emails. To begin, first create a Google object using the OAuth2 object from the previous sections. The mailType parameter refers to the Mail type used to send and receive ema...
11 Creating, Updating, Assigning Email Labels Creating a label for emails is simple. Use the .createLabel() function to create a label, such as the “Backup” label below: $status:=$google.mail.createLabel({name: "Backup"}) $labelId:=$status.label.id The label name, total messages, and unread messages can be obtained u...
12 Establishing Connection and Obtaining the Access Token Once the application is registered, the connection procedure is extremely similar to the previous example when connecting to Google. First, create the OAuth2 object and fill out the relevant information and client ID taken from the registered application. // C...
13 Send, Receive, Delete Emails via Microsoft Graph API To begin, create a Microsoft365 object from the OAuth2 information above. Similar to the Google object, Officer365’s mailType could be MIME and JMAP. However, the default option is the additional Mail type, “Microsoft”. $office365:=cs.NetKit.Office365.new($oAut...
14 Deleting emails utilizes the .delete() function. Below is an example to all the email in the $mails collection. For each ($mail; $mails) $office365.mail.delete($mail.id) End for each Note: Unlike Google, you may not be able to permanently delete items from Microsoft’s recoverable items deletion folder. For more ...
15 Conclusion This tech note went over how to get started with setting up applications for both Google’s Gmail API and Microsoft’s Office365 API and using 4D NetKit to establish a connection to them to call its most used functions. As internet protocols grow and change over time, it becomes more important for a 4D d...
1 Single Window App – Modernize your application By Thomas Maul, 4D Germany. Technical Note 24-14
2 Table of Contents Table of Contents ............................................................................................2 Abstract........................................................................................................3 Introduction ................................................................
3 Abstract Based on an older 4D example, 4D Invoice, this technical note demonstrates ways to modernize an older application into a modern Single Window app. It covers a dynamic, usercustomizable toolbar, a user-customizable list box, and finally, a display and user interaction approach similar to Microsoft Outlook. ...
4 Part 1 - Toolbar – Ribbon Bar Especially on Windows SDI (Single Document Interface) Applications are not using menu bars but focus on Ribbon or Toolbars. This part of the technical shows how to implement a dynamic toolbar, responding to window resizes, allowing the end user to position and chose functionality as n...
5 Toolbar Setup – End user setting The Settings dialog allows the end user to select which buttons to be displayed – and allowing to reposition them, or to move buttons from a subgroup to become a main button. In the example database, click the button “Settings”, then “Toolbar Setup”, to get this dialog: The left area...
6 To install in your application, copy the class “Toolbar_Setup” and the project form “Toolbar_Setup” in addition to the two main classes, into your application. The form “Toolbar_Setup” uses some localized strings, which are stored in Resources/en.lproj/ToolbarEN.xlf”, copy this file/folder as well. A German transla...
7 Toolbar Init – Using code Doing all by code is more work – but gives more control. Get a new instance of cs.Toolbar, as above. Then, for each button, get an instance of cs.Toolbar_Button and add it to the toolbar object using Form.toolbar.add($mybutton) When you create a new instance of Toolbar_Button, you need to (...
8
9 Function useAll($class : 4D.DataClass)->$all : 4D.EntitySelection If ($class.useAll#Null) $all:=$class.useAll() Else $all:=$class.all() End if Looks maybe a little bit unusual, but the idea is simple. It checks if the given table/class has a class function named “useAll”. If yes, it calls that method, else it calls...
10 When you display clients in the window, a search box is displayed in the toolbar. Switching to projects, search box disappears (as there is no quickSearch function in class Projects). Using the Toolbar through the setup dialog assign ORDA_Listbox_Method as callback. The method checks for clicks or On Data Change e...
11 Priority, which button to reduce first. Smaller numbers reduced last, highest first Not a standard 4D object property group (text) When group changes, buttons are separated with a vertical line Not a standard 4D object property icon relative 4D path to 32x32 png of type 4 state button, such as /RESOURCES/Images/B...
12 type for dataSource. For SearchPicker pass "text" You should not need to call any of these methods yourself for using the Toolbar. Only use them, if you need to enhance/rewrite functionality. Part 2 – Customizable list box To add a customizable list box to your application you just need to add one class, doing all ...
End of preview. Expand in Data Studio

Tech Notes PDF text 24-11 to 26-03

Downloads last month
95