KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Make sure you have 4D v12's new SQL Macros!
PRODUCT: 4D | VERSION: 12 | PLATFORM: Mac & Win
Published On: March 14, 2011

Because of the Macros.xml file's new content, SQL Macros, it is very advantageous to make sure that the Macros.xml file that comes with 4D v12, beginning with version 12.1, gets installed into the Active 4D folder. However, just because 4D v12.1 or later has been installed and launched, the expanded Macros.xml file may not get installed as expected.

There are three scenarios that affect the install of the new Macros.xml file into the Active 4D folder. The Active 4D folder if the folder return by the 4D function Get 4D folder ( Active 4D folder ).

  1. If the Macros folder and the Macros v2 folder exists in the Active 4D folder, the first time a database is opened or created with 4D v12.1 or later the folder will be created and the expanded Macros.xml file will be installed.

  2. If the Macros folder exists but not the Macros v2, the Macros v2 folder will be created and the files contained in the Macros folder will be copied to the Macros v2 folder. Since the Macros.xml file is copies from the Macros folder into then Macros v2 folder the SQL macros are not included in the Macros.xml file.

  3. If the Macros v2 folder exists in the Active 4D folder it remains untouched. Even if the folder is empty, no files are added to it.

So, what to do?

If scenario one applies, there is nothing else to do. The expanded macros file is installed and the SQL macros are ready for use.

If scenario two applies, move the Macros folder outside the Active 4D folder or rename the folder so that it will not be seen as existing. Launch 4D v12.1 or later and the Macros v2 folder will be created and the expanded Macros.xml file included. Now restore the Macros file to the Active 4D folder and move any additional macro files that are in the Macros folder to the Macros v2 folder as desired.

If scenario three applies, there are additional decisions to be made. As with scenario two, move the Macros and Macros v2 folders outside the Active 4D folder or rename them so that they will not be seen as existing. Launch 4D v12.1 or later and the Macros v2 folder will be created and the expanded Macros.xml file included. Now restore the Macros file to the Active 4D folder. If there are macro files other than the Macros.xml file in the old Macros v2 folder, move them into the new Macros v2 folder now. If the old Macros.xml file was not customized with macros not included in the original, now is the time to open both files with a text editor and add the custom macros to the new Macro.xml file. If the no custom macros existed in the old file, the task is done.

The v12 expanded Macros.xml file contains the addition macros listed below:

    <!-- Useful SQL statements -->
  •    <macro name="SQL_USE_4D_Function" type_ahead="true" in_menu = "true">
  •    <macro name="SQL_USE_FILTERS" type_ahead="true" in_menu = "true">
  •    <macro name="SQL_EXPLICIT_INNER_JOIN" type_ahead="true" in_menu = "true">
  •    <macro name="SQL_IMPLICIT_INNER_JOIN" type_ahead="true" in_menu = "true">
  •    <macro name="SQL_CROSS_JOIN" type_ahead="true" in_menu = "true">
  •    <macro name="SQL_LEFT_OUTER_JOIN" type_ahead="true" in_menu = "true">
  •    <macro name="SQL_RIGHT_OUTER_JOIN" type_ahead="true" in_menu = "true">
  •    <macro name="SQL_FULL_OUTER_JOIN" type_ahead="true" in_menu = "true">
  •    <macro name="SQL_REPLICATE_IN_ARRAYS_SHORT" type_ahead="true" in_menu = "true">
  •    <macro name="SQL_REPLICATE_IN_FIELDS_SHORT" type_ahead="true" in_menu = "true">
  •    <macro name="SQL_REPLICATE_IN_ARRAYS_FULL" type_ahead="true" in_menu = "true">
  •    <macro name="SQL_REPLICATE_IN_FIELDS_FULL" type_ahead="true" in_menu = "true">
  •    <macro name="SQL_SYNCHRONIZE" type_ahead="true" in_menu = "true">