I observe strange behaviour when I try to make use of SQL from InfoQube.
I have created two fields, which I have tried to make as identical as possible. The fields are called FieldA and FieldB. I have then defined two grids, called GridA and GridB based on fields FieldA and FieldB respectively. I have defined further fields called ValidA and ValidB which are based on GridA and GridB respectively.
ValidA is a text field. In the editor section of the properties for the field, I specify:
SELECT item AS ValidA FROM GridA and also tick “Entry must be in list”.
ValidB is a text field. In the editor section of the properties for the field, I specify:
SELECT item AS ValidB FROM GridB and also tick “Entry must be in list”.
Figure 1 shows the field properties for FieldA:
When I seek to use the drop-down field ValidA, the values available to me are shown in figure 4. Note that several valid values are omitted from this list.
I choose the value A4, and the value is stored OK.
When I seek to use ValidB, values available to me are shown in figure 5. This list appears to be just the TLI values in FieldB.
In neither case are all the available values displayed. In the case of ValidA, there are some missing values. In the case of ValidB, and in several other cases which I have tried, only the TLI values are returned.
Despite the setting “entry must be in list”, it is possible to edit the value chosen and set it to anything you like - figure 6 Point 1 shows the invalid value B3Invalid. This value should have been rejected because it does not form a part of the record set returned by the SQL SELECT statement.
Closing and then reopening the application makes no difference to this behaviour.
I have then amended the SQL statement to add the clause ORDER BY item DESC for both ValidA and ValidB.
The results for ValidA are frankly bizarre, in that the order has changed but is incorrect - see figure 7.
The results for ValidB make are also incorrect - see figure 8.
Notice how the order has changed, but it is giving incorrect answers.
I have then added four items to GridB, all of which exist in FieldA. See figure 9 point 1.
I have amended the SQL for ValidB so that it now reads:
SELECT GridB.item AS ValidB FROM GridA, GridB WHERE GridB.FieldB = GridA.FieldA ORDER BY GridB.item DESC
This SQL statement does not work. When I now click on the drop-down list in ValidB the message displayed is:
The query:
SELECT GridB.item AS ValidB FROM GridA, GridB WHERE GridB.FieldB = GridA.FieldA ORDER BY GridB.item DESC
If the SQL references an IQ grid, this grid must be set to be visible to other applications (grid properties > options)
Again, I am happy to amend the standard documentation if this behaviour can be explained and/or if better syntax is available – but I need the help of Pierre to be able to do this.
Comments
Regarding the sorting problem: I suddenly recalled an ancient discussion on this forum which can be found at: www.sqlnotes.net/drupal5/index.php. Briefly, fields in InfoQube are based on what used to be called a memo field in Microsoft Access (now renamed long text). InfoQube uses the so-called JET database engine which is also used in (desktop) Microsoft Access. This database engine implements only a subset of the full SQL standard and imposes a number of restrictions. One among these is that you cannot sort on a memo field - and in InfoQube, all text items are implemented as memo fields in the underlying database