The sequential key record in OpenInsight is stored in the %SK% field of the dictionary associated with the data table. So, if I was using a table called CUSTOMER_INVOICES and it had a sequential key, there would be a record %SK% in the table DICT.CUSTOMER_INVOICES . This record can beread/manipulated in the same manner as any other record in OpenInsight. The following programs illustrate reading/writing a sequential key.
Function ReadSK(charstr TableName)
/* This program will read the Sequential Key value */
Key = %SK%
Open DICT. : TableName to hTable else
*Unable to open table, Error processing
Return @file.error<1>
End
Read SK from hTable, Key Else
*Unable to read record
Return @file.error<1>
End
Return SK
Function WriteSK(charstr TableName, charstr SKey)
Key = %SK%
Open DICT. : TableName to hTable else
*Unable to open dictionary for table TableName
Return @file.error<1>
End
Write SKey on hTable , key else
*Unable to write skey on dict.tablename
Return @file.error<1>
End
Return 0
The first function reads the sequential key for the table that it is passed and returns it, the second one writes the a new sequential key value on the table that is passed.