Thank you everybody for all your answers. I have used debug and stepped though the subroutine. While adding a new record the program is reading the new non existing record from the same file and not returning anything for the virtual field. This is one reason for not updating the index in the first place.
I have tried to write same record twice with the same ID overwriting the existing record. In this case the subroutine return the correct value but the index still does not get updated. I have located following text from the documentations "A virtual attribute that contains a TRANS statement to another file, or the same file, is not a recommended use of an alternate key index, unless the file being translated to does not change. If the file being translated to does change, the alternate key index is not updated. Therefore, to obtain accurate results from a UniQuery statement, the alternate key index would need to be rebuilt each time the associated file is updated." Our problem is actually similar to Martin's birth year calculation example. The subroutine is looking at the same file for data. I understand the problem now. We should be able to implement a work around. Thank you again. Regards Kafsat -----Original Message----- From: Alfke, Colin [mailto:[EMAIL PROTECTED] Sent: Thursday, 4 November 2004 6:06 AM To: [EMAIL PROTECTED] Subject: RE: [U2] Index problem I believe it's even in the documentation that UniData will only update an index on the file that is being updated and not any other files that may have an index that references that file. Another work around is to have a trigger on the header file re-file the detail items that reference it so that the index is properly updated. I'm not sure if you'll have to "change" the detail item or not for it to cause the index to be updated. hth Colin Alfke Calgary - soon to head to LA.... >-----Original Message----- >From: Warren, Phil [mailto:[EMAIL PROTECTED] >Sent: Wednesday, November 03, 2004 7:25 AM >To: '[EMAIL PROTECTED]' >Subject: RE: [U2] Index problem > > >We've run into a similar problem with virtual attributes that reference >other files in all versions of UniData through to version >6.0.8. I wonder >if this might be a similar 'anomaly' > >For example, >In our case we have 2 order files, named HEADER and DETAIL. A virtual >attribute exists in the DETAIL file which references the HEADER file. >When the DETAIL record(s) are written out before the HEADER >record, UniData >does not update the DETAIL index when the HEADER file is >written, causing a >null value when the DETAIL index is used. As in your case, >when another >attribute is used, to select the DETAIL file, which does not >use the index, >the items are selected as expected. > >The only work around that we've used, is to rebuild the index >file daily. >Perhaps there is a better work around or fix? > >-Phil- ------- u2-users mailing list [EMAIL PROTECTED] To unsubscribe please visit http://listserver.u2ug.org/ This email and any attachments are confidential and intended solely for the use of the person or entity to whom they are addressed. If you are not the intended recipient, please do not disclose, store, copy or take any action in reliance on it or them. If you have received this message in error, please tell us by reply email (or telephone + 61 (0) 3 9274 9100) and delete all copies on your system. Any opinion, advice or information in this email is not necessarily that of the owners or officers of this company. Please advise us immediately if you or your employer do not consent to email for messages of this type. Retail Decisions has taken reasonable precautions to ensure that any attachment to this email has been swept for viruses. However, we cannot accept any liability for any damage sustained as a result of software viruses, and would advise that you carry out your own virus checks before opening any attachment. Please note that communications sent by or to any person through our computer system may be viewed by other Retail Decisions employees or officers strictly in accordance with law. ------- u2-users mailing list [EMAIL PROTECTED] To unsubscribe please visit http://listserver.u2ug.org/