Tips & Tricks for your 4D Apps – July Edition
by Add Komoncharoensiri, Director of Technical Services at 4D Inc
Here we go with another set of tips and tricks.
As you know, 4D Knowledge Base is a library of information about the 4D technology where weekly tech tips and monthly technotes 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:
HTTP classes: A New Way to Perform Asynchronous HTTP Requests
In our constant effort to improve 4D syntax and functionalities, we have decided to bring you new commands to perform HTTP requests in 4D: the HTTP classes. They are available right in 4D v19 R6 and will feature many improvements over the coming versions. Let me show you how to use them right away.
Microsoft 365: Get user information from Azure
Many companies are using Microsoft 365 (former Office 365). Besides providing access to Office applications, Microsoft provides an Azure-based Active Directory, allowing users to log in to access services such as Microsoft Sharepoint or OneDrive using a Web Browser.
All Microsoft services use the same Single Sign-On, based on the email address. From 4D v19 R6, 4D NetKit allows you to join this concept, allowing users to log in to your application using their usual company credentials.
Besides allowing Single Sign-On, it will enable to retrieve information for the authenticated user such as email, department, and phone number. If permitted by the administrator, you can even retrieve such details on colleagues from the same company.
Let’s see how it works.
Microsoft 365: Send Emails
We know the importance of sending emails, and the fact that it’s a common task in today’s applications. Many people working with Office 365 have asked us for an API to send emails via the Microsoft Graph API. The OAuth 2.0 feature was a prerequisite for connecting to the Microsoft server and for introducing commands to retrieve user information. We are glad to proceed with email management, starting with the send email command.
Support of larger integers than integer32
While Reals are known to be unprecise, they are 100% accurate even for very large numbers, as long as they do not use a decimal point (=integers).
Numbers up to 53 bit, or more exactly, [-(2^53)+1, (2^53)-1], that is a range from −9,007,199,254,740,992 to 9,007,199,254,740,992, will be exactly represented.
4D for Mobile: Say Hello to Aliases
As you probably know, aliases have been available since 4D v19 R4. Aliases and computed attributes were a massive step forward for our development framework!
The days of defining business-related formulas in your 4D user interface are over; these concepts offer you a new way to separate your business logic from the UI, enabling you to improve performance by optimizing the parts separately.
And now, with 4D v19 R6, aliases are fully available and ready to use for scalars in your iOS and Android mobile projects as soon your aliases are defined on the 4D side.
Developing Concurrently on 4D Server in Project Mode
Since its release in 4D v18, Projects drastically expanded 4D’s capabilities by bringing compatibility with version control systems —among other things.
With excellent feedback, we couldn’t be prouder to see significant adoption of this feature among the 4D community. This pushed us to improve it to make it even better.
Your feedback included a request for the possibility to work simultaneously on a single development server as a team. Again, 4D listened, and we are thrilled to announce that with 4D v19 R6, you can work on a development server in project mode!
The Use of Formulas in Collections & Callback Commands
When you use collections with a member method that needs a callback method, many of you have asked us for a more straightforward way.
You asked; we delivered!
Starting with 4D v19 R6, 4D allows you to use a formula to define a callback in the collection member functions, the EXECUTE METHOD IN SUBFORM, CALL FORM, and CALL WORKER commands. If you can reduce your code to a simple expression, you can pass it directly into the formula without using a method.
4D Write Pro: Disable Visibility of Empty Images
4D Write Pro documents can contain images from different sources and in various formats. These images may, in some cases, not be displayed for totally reasonable reasons — such as invalid URLs, formulas returning empty images, formats not supported by the platform, etc.
However, they are always represented by a small empty rectangle showing their theoretical location. If you want to change this behavior, 4D v19 R6 is shipped with a new view option enabling you to make empty images completely invisible.
4D View Pro: Display your Collections as Tables
You know it already; 4D View Pro allows you to easily load and display data in spreadsheets.
4D v19 R6 brings exciting news. This blog post will show you the new table feature that enables you to do much more and benefit from additional properties like headers, table resize, summary row, column sorting, filters, and more. You’ll also discover how to quickly load data from data classes and collections. And don’t miss out on the demo, which provides a complete example and some visual charts as a bonus.
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