Tips & Tricks for your 4D Apps – February 2024 Edition
by Add Komoncharoensiri, Director of Technical Services at 4D Inc
Here we go with another set of tips and tricks.
The 4D Knowledge Base is a library of information about 4D technology where weekly tech tips and monthly tech notes are actively published. If you missed the last tips on the KB, that’s fine; here is a compilation from the past few weeks.
This blog post covers 12 tips:
Tips & Tricks for your 4D Apps – November 2023 Edition
by Add Komoncharoensiri, Director of Technical Services at 4D Inc
Here we go with another set of tips and tricks.
The 4D Knowledge Base is a library of information about 4D technology where weekly tech tips and monthly tech notes are actively published. If you missed the last tips on the KB, that’s fine; here is a compilation from the past few weeks.
This blog post covers 16 tips:
Files, Folders… and now File Handles!
The File and Folder commands, which appeared in 4D v17 R5, enable you to manage folders and files on disk in a modern and efficient way.
When it comes to writing and reading, the setText and getText functions are at your disposal to read or write the entire content. But what to do if you want to read or add one or more lines to an existing document? This can be done more efficiently than ever using the new “file handles” objects in 4D v19 R7.
Keep reading for details!
4D v19 R6 Beta Starts today
We are pleased to announce the launch of beta testing for 4D v19 R6! This release is loaded with enhancements and new features that you won’t want to miss!
Let’s take a look and discover what’s new in the 4D v19 R6 Beta:
- Horizontal and vertical padding for list boxes — so your interface can have an even more professional look.
- Developing concurrently on 4D Server in Project Mode — so you can adopt Project Mode without impacting your organization if you still work with binary mode.
- Define a “datasource” for the tables of 4D Write Pro — so the end-users of your application can design or modify templates that will be filled automatically with data.
- Native support for Microsoft 365 — so you can support Single Sign-On, and retrieve information for the authenticated user, to name a few possibilities.
- 4D for Mobile aliases — so you can retrieve values at several degrees of depth and display even more relevant information in your mobile app.
- Much more awaits you!
Stop press! Accessing parameters not being passed is … possible
A method or function can have optional parameters. Sometimes the function is called with two parameters, and other times with three parameters. We’ve all dreamed of accessing the parameters without counting the parameters, checking if the parameter has been passed, or simply not having to check if the variable associated with the parameter has been initialized. This could make the code much simpler, and much more readable, without all the “If” or “Count parameters” lines.
Well, dream no more, and switch to 4D v19 R3! Managing method and function parameters has never been easier.
Tips: ORDA Data Model Classes
By now you’re aware of the availability of ORDA classes. In this blog post, you’ll learn a few handy tips to get the most out of them!
An intro to object-oriented programming in 4D: Classes
Many of you have have been asking to be able to define an object type ever since the Object type became available. Thanks to object notation, many of you dream of having object functions. Dream no more and say hello to classes in 4D v18 R3 project database! In this blog post, we’re introducing one of the most interesting concepts of object-oriented programming … along with a database example and a bonus video!
Web Scraping using object notation
Want to retrieve data that isn’t available via REST or Web Services? What if it’s only available on a website? The data is easy enough for a human to read, but reading HTML data with a programming language isn’t so simple. Some developers try to use Position and Substring, others try Regex, but it’s unpleasant and time-consuming. A very different approach is to convert the HTML into an object and get the data via object notation. Table rows are handled as collections and are easy to loop through!
This blog post describes how to use this approach and provides some handy tips.
4D v18 beta starts today
Beta testing for 4D v18, our most spectacular release yet, is starting today! And we couldn’t be more thrilled to share all the novelties we’ve prepared for you. More than +90 advances, including major enhancements to existing features, as well as new ones that were designed to ease your development journey and take your applications to new heights. And in case you want to have an overall idea on this release full potential, we’ve put together this extensive library of examples (HDIs).
Buckle up and let’s discover some of what 4D v18 Beta has to offer:
- Project database – Version control: a solution for collaborative programming. Enabling you to store your code in a source control system (e.g., Github, Perforce, etc.) in plain text files.
- Built-in encryption: protection at its finest with built-in data encryption on a per-table basis.
- 4D for iOS: a product fully integrated into 4D to extend your business applications to mobile with ease.
- ORDA: enhanced commands, enhanced performance … and then there is remote datastore.
- 4D language: extra 4D commands to enlarge your programming capabilities.
- 4D Write Pro: Style Sheets. Tables. Toolbar. Word Export. And much more.
- 4D View Pro: Ribbon Toolbar. Excel import/export. And the list goes on.
- And much more (see below).
An ORDA Cheat Sheet
Blog post by guest author Cannon Smith, a 4D developer from southern Alberta, Canada:
The introduction of collections and entities has dramatically changed the landscape in 4D, giving developers new ways to map business rules to code. Just recently I refactored several thousand lines of code that were central to the business rules of our application, resulting in a significant speed improvement (5xs faster) which our users are very happy about. This refactoring was largely about moving from old code constructs to objects, collections, and ORDA.
Contact us
Got a question, suggestion or just want to get in touch with the 4D bloggers? Drop us a line!
* Your privacy is very important to us. Please click here to view our Policy