Parameter | Description |
---|---|
iOrder | Ordering (index) number |
Returns True if the constraints you are using require relates to determine if a record is valid
Function DDOConstraintNeedsRelate Integer iOrder Returns Boolean
Call: | Get DDOConstraintNeedsRelate iOrder to BooleanVariable |
When you are reading a batch of records there will be times when you don't really need to perform relates.
In such a case, you can set the No_Relate_State property to True to disable constraints. Before you do that, you want to make sure that the constraints you are using do not require relates to determine if a record is valid. If a relate is required, a relate must occur. While you could do this by getting DDOConstraintFindMeta and looking at the bPostRelate member, you can test this directly by getting DDOConstraintsNeedsRelate. You pass it an index and it will tell you if the current constraints require a relate.
For example, if you wanted to find the total of all orders based on current constraints you could do the following:
Move oOrderHea_DD to hoServer Move 1 to iIndex Get No_Relate_State of hoServer to bOldRelate Get DDOConstraintNeedsRelate of hoServer iIndex to bNeedsRelate Set No_Relate_State of hoServer to (not(bNeedsRelate)) Send Request_Read of hoServer FIRST_RECORD Orderhea.File_Number iIndex Move (Found) to bOk While (bOK) Move (Orderhea.Total+nTotal) to nTotal Send Request_Read of hoServer GT Orderhea.File_Number iIndex Move (Found) to bOk Loop Set No_Relate_State of hoServer to bOldRelate
This type of technique is most useful when building classes that need to read records for an set of constraints.