User Tools

Site Tools


changes_return_changed_queue_.htm
Navigation:  Language Reference 13 - Built-in Functions ====== CHANGES (return changed queue) ====== Previous pageReturn to chapter overviewNext page

CHANGES( queue )

blk2blue.jpg

CHANGES Returns a “Change ID” or “Change Count” value for the QUEUE.
queue The label of a QUEUE structure, or the label of a passed QUEUE parameter.

The CHANGES procedure returns a LONG integer containing a unique “Change ID” value for the current QUEUE contents. Saving this value then later comparing the saved value to the current return value from CHANGES allows you to easily detect that the QUEUE contents or order may have been changed by specific statements.

If any of these five statements act on the QUEUE the Change ID is incremented: FREE() ADD() PUT() DELETE() SORT(). If a PUT does not change the contents the Change ID is still incremented. If a SORT does not change the order the Change ID is still incremented. The Change ID is simply a count of likely changes.

These five statements read the Queue data or header, but in no way can change it, so do not increment the Change ID: GET() CLEAR() RECORDS() POINTER() POSITION().

Return Data Type: LONG

Note: CHANGES() as documented in the Clarion help as returning a “Hash Value” is completely WRONG.

Example:

SaveChangeID  LONG
Que       QUEUE
Name       STRING(10)
          END
 CODE
 Que.Name = 'Jones'  
 ADD(Que)                 !Add the entry
 ASSERT(~ERRORCODE())
 SaveChangeID = CHANGES(Que)  !Save the Change Count of the QUEUE
 Que.Name = 'Jones II'
 ADD(Que)                 !Add another entry, changing the QUEUE contents
 ASSERT(~ERRORCODE())  
 IF SaveChangeID <> CHANGES(Que) !This should be a true expression here
  MESSAGE('CHANGES procedure worked correctly')
 END

See Also:

QUEUE

changes_return_changed_queue_.htm.txt · Last modified: 2021/04/13 12:01 by carlbarnes