KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: What is data type 26
PRODUCT: 4D | VERSION: 12.4 | PLATFORM: Mac & Win
Published On: July 23, 2012

Beginning with 4D v12 users have the ability to access the dynamically created arrays contained in a List Box built as a result of an SQL query, like the one shown below.

Begin SQL
    SELECT COUNT(*), open_date
    FROM Account
    GROUP BY open_date
    INTO <<SQLQueryListBox_aB>>;
End SQL


The List Box that is the trarget of this query is an Array based List Box with no columns installed. On the form that appears as below:



Notice that the first noun in the SELECT clause is an SQL Function, in this case COUNT(*), instead of a field from the table Account. This code produces the list box that appears below.



Notice the header on column 1. It says it is an expression instead of a field. If you try to access the data in that column it would appear to be numeric but a test in the debugger will reveal that the poiner points to an expression that is going to execute as each row is accessed. Testing the pointer with the 4D command Type returns a value of 26, see the image below.



In compiled mode the data cannot be accessed by dereferencing this pointer as can be done with pointer that points to an actual data array. However, if the listbox is not an empty list box and the target of the expression is an actual arrray, as in the example below, the data can be accessed for export or other action.

ARRAY LONGINT(Count_aL;0)
ARRAY DATE(OpenDt_aD;0)
Begin SQL
    SELECT COUNT(*), open_date
    FROM Account
    GROUP BY open_date
    INTO :Count_aL, :OpenDt_aD;
End SQL