4th Dimension (software)

{{Short description|Relational database and programming language}}

{{Redirect|ACIUS|the 3rd-century Christian martyr|Acius}}

{{Infobox programming language

| name = 4D Programming Language

| logo =

| logo caption =

| screenshot =

| screenshot caption =

| paradigm =

| family =

| designer = Laurent Ribardière

| developer = 4D SAS

| released = {{Start date and age|1984}} (dev) {{start date and age|1987}} (official){{cite web|title=High-End Mac Database Offers Own Programming Language|date = 16 March 1987|url=https://books.google.com/books?id=PDwEAAAAMBAJ&q=4th+dimension+silver+surfer+release+date&pg=PA6|publisher=InfoWorld}}

| latest release version = v18 R5

| latest release date = {{start date and age|2021|01|19}}

| latest preview version = v18 R6 Beta

| typing =

| scope =

| programming language = C, C++

| discontinued =

| platform = Cross-Platform

| operating system = Windows, macOS

| license = Proprietary

| file ext = 4DB, 4DC

| file formats = Interpreted, Compiled

| website = {{URL|us.4d.com}}

| implementations =

| dialects =

| influenced by =

| influenced =

}}

{{Infobox software

| name = 4D

| logo =

| screenshot =

| caption =

| collapsible =

| author = Laurent Ribardière

| developer = 4D SAS

| released = {{Start date and age|1984}} (ss) {{Start date and age|1987}} (v1)

| programming language = C++, C

| operating system = Windows, Mac OS

| latest release version = v18 R5

| latest release date = {{start date and age|2021|01|19}}{{cite web |url=http://www.4d.com/products/lifecycle.html |publisher=4D |title=4D Product Lifecycle |access-date=2016-01-10}}

| latest preview version = v18 R6 Beta

| size =

| language =

| language count =

| language footnote =

| genre = RAD RDBMS IDE Language GUI Designer Web Server

| license = Proprietary

| website = {{URL|us.4d.com}}

}}

{{Infobox software

| name = 4D Server

| logo = Logo4D.svg

| logo size = 72px

| screenshot =

| caption =

| collapsible =

| author = Laurent Ribardière

| developer = 4D SAS

| released = {{Start date and age|1993}} (v1)

| programming language = C++, C

| operating system = Windows, Mac OS

| latest release version = v18 R5

| latest release date = {{start date and age|2021|01|19}}{{cite web |url=http://www.4d.com/products/lifecycle.html |publisher=4D |title=4D Product Lifecycle |access-date=2016-01-10}}

| latest preview version = v18 R6 Beta

| size =

| language =

| language count =

| language footnote =

| genre = RDBMS Web Server Application Server SQL Server Database Server Language

| license = Proprietary

| website = {{URL|us.4d.com}}

}}

4D (4th Dimension, or Silver Surfer, as it was known during early development) is a relational database management system and integrated development environment developed by Laurent Ribardière.{{cite web|url=http://www.4d.com/company/about/team.html|title=4D People - 4D|work=4d.com|date=19 June 2018 }} 4D was created in 1984{{cite web|url=http://www.4d.com/company/about/innovation.html|title=A History of Innovation|work=4d.com|date=19 June 2018 }} and had a slightly delayed public release for Macintosh in 1987{{cite web|title=Overdue Apple Server Goes to Market|date = 26 January 1987|url=https://books.google.com/books?id=qSErMDyLDosC&q=4th+dimension+silver+surfer+release+date&pg=PA1|publisher=ComputerWorld}}{{cite web|title=New Database Software Program Moves Macintosh Into The Big Leagues|url=https://www.chicagotribune.com/1987/06/28/new-database-software-program-moves-macintosh-into-the-big-leagues/|website=chicagotribune.com}}{{cite web|title=Seeking 4th Dimension? Take Heart, It's Now In Town|url=https://www.chicagotribune.com/1987/07/12/seeking-4th-dimension-take-heart-its-now-in-town/|website=chicagotribune.com}} with its own programming language.

The 4D product line has since expanded to an SQL back-end, integrated compiler, integration of PHP, and several productivity plug-ins and interfaces. Some of the plug-ins created by 4D include 4D Write (a word processor), 4D View (somewhat like a spreadsheet, but with extra functionality) and 4D Internet Commands (which allowed for the addition of Internet-related functionality to a database). There are also over 100 third-party plugins, free and commercial.

4D can also be used as a web server, to run compiled database applications.

Today, 4D is published by the French company 4D SAS and has a sales, distribution and support presence in most major markets, with the United States, the United Kingdom, and France being the primary markets. The product is localized in more than a dozen languages.

History

Silver Surfer, as it was known during early development, was developed by Laurent Ribardière in 1984. Following negotiations with Ribardiere it was planned that Apple Inc. (formerly Apple Computer Inc) would publish the software but Apple canceled the plan, reportedly due to pressure from other potential database publishers who claimed that if Apple had their own "brand" database, third party products would be disadvantaged in the marketplace.{{Cite book

| url = https://archive.org/details/macintoshway00kawa/page/18

| title = The Macintosh Way

| last = Guy

| first = Kawasaki

| publisher = Scott Foresman Trade

| year = 1989

| isbn = 0673461750

| location = United States

| pages = [https://archive.org/details/macintoshway00kawa/page/18 18]

| url-access = registration

}} Apple tried at the time to ensure well-known software publishers supported the Macintosh platform, and as a result the project reverted to Laurent Ribardière, who with the French businesswoman Marylene Delbourg-Delphis published 4th Dimension. Although independently published, Apple supported the new venture and used 4D extensively throughout the organization for projects including fitness center management and CIM (Computer Integrated Manufacturing). A number of Apple personnel became 4D experts, including Lance McAndrew in Apple's Cupertino headquarters and Andrew O'Donoghue in Apple's Ireland-based European manufacturing headquarters, where a 4th Dimension application managed the European Service Center administration.

Over the next few years 4th Dimension's installed base grew, and the publisher ACI established a US-based subsidiary called ACIUS, initially led by Guy Kawasaki. After 16 years of operating as ACIUS up to 2000, the name was officially changed to 4D Inc.{{cite web|title=Good Bye ACI US, Hello 4D, Inc.|url=http://www.macnews.com/content/good-bye-aci-us-hello-4d-inc-0|website=MacNews.com}}

In 1993, 4D Server v1.1, the client/server version of 4th Dimension was introduced along with the release of 4th Dimension v3.1.{{Cite book

| url = https://books.google.com/books?id=FzsEAAAAMBAJ&q=4d+server+1993&pg=PA22

| title = 4D Server delivers on the promises of others

| last = InfoWorld

| date = 27 December 1993 – 3 January 1994

| publisher = InfoWorld Media Group, Inc.

| language = en

}}

In 1995, 4D v3.5 went cross-platform and has since then supported both the Microsoft Windows and Apple Macintosh operating systems.{{Cite book

| url = https://books.google.com/books?id=aEpNXuyUcfoC&q=4d+server+1995+windows&pg=PT72

| title = Database maker opens new Windows

| last = ComputerWorld

| date = 24 July 1995

| publisher = ComputerWorld

| language = en

}}

In 1997, 4D v6 was the first version of 4D to contain a fully integrated web server, allowing developers to translate 4D forms into HTML on the fly using only the 4D language.{{Cite book

| url = https://books.google.com/books?id=3zsEAAAAMBAJ&q=4d+server+1997+web+server&pg=PA109

| title = 4th Dimension suitable for mixed Mac, Windows sites

| last = InfoWorld

| date = 9 June 1997

| publisher = InfoWorld Media Group, Inc.

| language = en

}}

In 2004, 4D 2004 was the first version of 4D to allow developers to create standalone, client/server, web and Service Oriented Applications (SOA) without changing any code.{{Cite press release

| url = http://www.businesswire.com/news/home/20040831005181/en/4D-Ships-4D-2004-Featuring-Streamlined-Design

| title = 4D, Inc. Ships 4D 2004 Featuring a New Streamlined Design Environment and New Deployment Technologies {{!}} Business Wire

| website = www.businesswire.com

| access-date = 2016-02-29

}}

In 2008, 4D v11 added a SQL layer to the 4D database engine and extending native SQL in to the 4D programming language which allowed 4D developers to write native SQL code to connect to either local or remote servers.{{Cite web

| url = http://www.prnewswire.com/news-releases/4d-announces-the-worldwide-release-of-4d-server-v11-sql-57535092.html

| title = 4D Announces the Worldwide Release of 4D Server V11 SQL

| website = www.prnewswire.com

| access-date = 2016-02-29

}}{{Cite web

|url = https://www.macnn.com/articles/08/06/25/4d.server.v11.sql.unveiled/

|title = 4D Server v11 adds SQL, optimizes performance {{!}} MacNN

|website = MacNN.com

|access-date = 2016-02-29

|archive-url = https://web.archive.org/web/20160305114300/https://www.macnn.com/articles/08/06/25/4d.server.v11.sql.unveiled/

|archive-date = 2016-03-05

|url-status = dead

}}

In 2010, 4D v12 integrated the ability to execute PHP functions/scripts from within the 4D programming language. This version also supported new replication and synchronization commands and included a 64 bit version of 4D Server.{{Cite web

| url = http://www.iclarified.com/9842/4d-v12-is-now-available

| title = 4D v12 is Now Available

| website = iClarified

| date = 4 June 2010

| access-date = 2016-02-29

}}

= Version history =

class="wikitable"

!Branch

!Latest version

!Initial release

!Final release

!Status Feb 2022

!Notes

v19.x

|v19.LTS

|12 Jul 2021

|Ongoing

|Supported

|Native support for Apple Silicon, Classes

v18.x

|v18.LTS

|16 Jan 2020

|Ongoing

|Supported

|Project Databases for Version Control, Built-in encryption tools, 4D for iOS, 4D Write Pro, 4D View Pro

v17.x

|v17.4

|10 July 2018

|13 Dec 2020
(4D v17.5){{cite web | url=https://fr.4d.com/cycle-de-vie-produits | title=Cycle de vie produits | date=13 January 2020 }}

|Support ended 13 Dec 2020

|ORDA (Object Relational Data Access), Collections, Object Notation, Dynamic forms

v16.x

|v16.6

|10 Jan 2017

|24 Jul 2019
(4D v16.6)

|Support ended 24 July 2019

|New Cache Management System, Preemptive Multithreading, 4D Dev Pro 64 bit

v15R

|v15R5

|10 Nov 2015

|14 Sep 2016

|Superseded by 16.x

|Preview of features to be in v16.x

v15.x

|v15.6

|16 Jul 2015

|25 Apr 2017

|Support ended 25 Apr 2018

|64 bit 4D Server for Mac servers; New network layer

v14R

|v14R5

|May 2014

|March 2015

|No longer supported

|preview of features to be in v15.x

v14.x

|v14.6

|12 Dec 2013

|20 Dec 2016

|No longer supported

|4D Mobile (Connectivity options for 4D Server as a datasource for Wakanda (software)); Structured JSON objects (C_Object); SQL views; new tools for maintenance and monitoring, new journaling system.

v13.x

|v13.6

|14 Feb 2012

|18 Jun 2015

|No longer supported

|New multithreaded HTTP server; automatic session management; new extensible HTTP client; webkit integration and extended Javascript support; enriched list box; external document management.

v12.x

|v12.6

|3 Jun 2010

|8 Oct 2013

|No longer supported

|64 bit 4D Server for Windows servers; PHP integration; Synchronization and Replication

v11.x

|v11.9

|23 Sep 2008

|7 Jul 2011

|No longer supported

|SQL engine; integrated maintenance center (MSC); SVG management; Integrated Web Area

2004.x

|2004.8

|31 Aug 2004

|30 Jun 2009

|No longer supported

|Revamped interface; Integration of high-level ODBC commands, 4D Customizer, 4D Backup and 4D Engine

2003.x

|2003.8r2

|17 Mar 2003

|11 Apr 2006

|No longer supported

|XML; Web Services; Embedded Compiler

v6.8.x

|6.8.6

|15 Apr 2002

|24 Sep 2004

|No longer supported

|

v6.7.x

|6.7.5

|

|

|No longer supported

|

v6.5.x

|

|18 May 1999

|

|No longer supported

|

v6.0.x

|6.0.5

|1997

|27 Feb 1998

|No longer supported

|Integrated Web Server

v3.x

|

|

|

|No longer supported

|4D v3.5 was the first cross-platform version (mac/win),

v1.x

|

|1987

|

|No longer supported

|Mac only

Architecture

A 4D application can run in either Standalone mode or Client-Server mode.

= Single-User =

In Standalone mode, the 4D application (4D.exe on Windows or 4D.app on Mac) is used to open the structure file (4DB/4DC) file directly along with the associated data file (4DD).

= Client-Server =

In the Client-Server paradigm the 4D Server application (4DServer.exe on Windows or 4DServer.app on Mac) is used to open the structure file (4DB/4DC) file directly along with the associated data file (4DD). 4D may then be used in remote mode to connect to the 4D Server.

Application Editions

4D has two applications; 4D and 4D Server. 4D Server runs only as a server but 4D can be run in either standalone or remote mode.

= 4D =

4D can be run in two modes. 4D in single-user mode allows for 1 person to run the application. 4D in remote mode is used for connecting to a 4D Server.

= 4D Server =

4D Server is used for Client-Server connectivity to the application. In this mode, 4D Server loads the structure file (4DB or 4DC) and also the datafile (4DD) and provides network access to 4D (in remote). Each workstation has a dynamically updated cache of the resources they are working with, while the 4D Server maintains the data and code.

Syntax

This section will include syntax examples demonstrating different programming constructs used in 4D, such as for loops and variable usage.

= Data Types =

4D fields, variables, and expressions can be of the following data types:{{cite web |title=Data Types |url=http://doc.4d.com/4Dv15R3/4D/15-R3/Data-Types.300-2695014.en.html |website=4D Doc Center |access-date=28 July 2022}}

class="wikitable"
Data Type

! Field

! Variable

! Expression

String

|{{Yes}}

|{{Yes}}

|{{Yes}}

Number (double)

| {{Yes}}

| {{Yes}}

| {{Yes}}

Date

| {{Yes}}

| {{Yes}}

| {{Yes}}

Time

|{{Yes}}

|{{Yes}}

|{{Yes}}

Boolean

| {{Yes}}

| {{Yes}}

| {{Yes}}

Picture

| {{Yes}}

| {{Yes}}

| {{Yes}}

Pointer

| {{No}}

| {{Yes}}

| {{Yes}}

BLOB

| {{Yes}}

| {{Yes}}

| {{No}}

Array

| {{No}}

| {{Yes}}

| {{No}}

Integer 64 bits

| {{Yes}}

| {{No}}

| {{No}}

Float

| {{Yes}}

| {{No}}

| {{No}}

Object

| {{Yes}}

| {{Yes}}

| {{Yes}}

Collection

| {{Yes}}

| {{Yes}}

| {{Yes}}

Undefined

| {{No}}

| {{Yes}}

| {{Yes}}

More info on 4D data type can be found on the [ 4D Data Types] documentation page

= Variable Scope =

Local variables are prefixed with a $ like $myLocalVariable and only live for the duration of the method.

Process variables have no prefix like myProcessVariable and live throughout the duration of the process.

Inter-process (or Global) variables are prefixed with a <> like <>myGlobalVariable and live throughout the duration of the application.

= Comparison of looping =

== For ==

For(vCounter;1;100)

// Do something

End for

== While ==

$i :=1 // Initialize the counter

While($i<=100) // Loop 100 times

// Do something

$i :=$i +1 // Need to increment the counter

End while

== Repeat ==

$i :=1 // Initialize the counter

Repeat

// Do something

$i :=$i +1 // Need to increment the counter

Until($i=100) // Loop 100 times

== Nested Loops ==

The following example goes through all the elements of a two-dimensional array:

For($vlElem;1;Size of array(anArray))

// ...

// Do something with the row

// ...

For($vlSubElem;1;Size of array(anArray{$vlElem}))

// Do something with the element

anArray{$vlElem}{$vlSubElem}:=...

End for

End for

The following example builds an array of pointers to all the date fields present in the database:

ARRAY POINTER($apDateFields;0)

$vlElem:=0

For($vlTable;1;Get last table number)

// loop over each table number with $vTable as the number

If(Is table number valid($vlTable))

// check if table number $vTable is valid

// only loop on the valid table

For($vlField;1;Get last field number($vlTable))

// loop over each field number within current table

// with $vlField as the current field number

If(Is field number valid($vlTable;$vlField))

// check if field number is valid

$vpField:=Field($vlTable;$vlField) // get pointer to field

If(Type($vpField->)=Is date)

// check if current field is a date

// only performs these actions if field is a date

$vlElem:=$vlElem+1

INSERT IN ARRAY($apDateFields;$vlElem)

$apDateFields{$vlElem}:=$vpField

End if

End If

End for

End If

End for

References

{{Reflist}}