Obsolete
Parameter | Description |
---|---|
file | Number of the table in the current filelist |
field | Number of the column in the table |
Property Integer Field_Main_Index
Read Access: | Get Field_Main_Index file field to IntegerVariable |
If this object has an Ordering and the specified file number is the Main_File, the Ordering will be returned, regardless of whether the specified column number has a main index (specified in the data file definition). If this object has no Ordering, the main index of the column will be returned. If the column has no main index and this object has no Ordering, -1 is returned.
Prior to DataFlex revision 8.2, the message Field_Main_Index was used by the DataDictionary and DataSet class to determine the main index for a passed file and field. This method had the drawback that the DDO (or DSO) receiving this message may not be the DDO that owns the file. For example, an Order DD may receive this message asking for the main index for a customer column (where Customer is the parent of Order). When this happens the order DD determines the main-index for this customer without sending a message to the owner customer DD. While this method works properly, it causes confusion when you want go to augment this method. An augmentation in the parent DD (the owner of the column) will not get called. It had been suggested that this be improved. We have implemented this improvement by adding the new messages File_Field_Index and Field_Index.
When sending this message you can use either File_Field_Index or Field_Index. Using File_Field_Index is easier because you do not have to worry that the message is sent to the correct DDO - it will find the owner DDO and send the message Field_Index.
When augmenting this method, always augment Field_Index in the owner DD. You can now be sure that this method will get called.
The packages have all been changed so they no longer call Field_Main_Index. They now call File_Field_Index.
Important Compatibility Note:
If you are using Field_Main_Index anywhere in your code it will still work exactly as before. We strongly encourage you to bring your code up to date. You should search your code and make the following changes:
1. Search for all occurrences where you call Field_Main_Index and change the name of the call to File_Field_Index.
2. Search for any occurrences of augmentations of Field_Main_Index (look for function Field_Main_Index) and change it as follows:
// Old pre DataFlex 8.2 code Function Field_Main_Index Integer File Integer Field Returns Integer // should be changed to Function Field_Index Integer Field Returns Integer
Notice the name change and the parameter change. Also make sure that the function is located in the owner DDO.
We do not expect that many developers call Field_Main_Index and we expect that even fewer developers have augmented this message. If you have augmented the message you might have already encountered the limitation with Field_Main_Index and, we hope, you will welcome this improvement!
Finally - if you are using DataSets instead of DDOs, no change is required. DataSets continue to use the Field_Main_Index method. (Of course, you want to use DDOs.)