GetRecField

Function GetRecField(ObHd:HANDLE;RecordName,FieldName:STRING):STRING;
VAR
	Q,CriteriaString:STRING;
BEGIN
	Q:=Chr(39);
	CriteriaString:=Concat('(',Q,RecordName,Q,'.',Q,FieldName,Q,')');
	GetRecField:=EvalStr(ObHd,CriteriaString);
END;

What it does
Returns the value in the specified record field. User must provide handle to object, and the object must have only one record attached. Handles that pesky EvalStr criteria specification.


IsRecAttached

Function IsRecAttached(theObject:HANDLE;RecordName:STRING):BOOLEAN;
VAR
	Q,CriteriaString:STRING;
	AttachStatus:REAL;
BEGIN
	Q:=Chr(39);
	CriteriaString:=Concat('(R IN [',Q,RecordName,Q,'])');
	AttachStatus:=Eval(theObject,CriteriaString);
	IF AttachStatus = 1.0 THEN
		IsRecAttached:=True
	ELSE
		IsRecAttached:=False;
END;

What it does
Returns a BOOLEAN value to indicate whether the specified record is attached to specified object.


BuildRecCrit

Function BuildRecCrit(Record,Field:STRING;RecordOnly,UseEqual:BOOLEAN):STRING;
VAR
	Q,CriteriaString:STRING;
BEGIN
	Q:=Chr(39);
	
	IF RecordOnly THEN BEGIN
		CriteriaString:=Concat('(R IN[',Q,Record,Q,'])');
		IF UseEqual THEN
			CriteriaString:=Concat('=',CriteriaString);
	END
	ELSE BEGIN
		CriteriaString:=Concat('(',Q,Record,Q,'.',Q,Field,Q,')');
		IF UseEqual THEN
			CriteriaString:=Concat('=',CriteriaString);
	END;
	
	BuildRecCrit:=CriteriaString;
END;

What it does
Formats and returns a record-field criteria, inserting quotes required by search strings with MiniPascal search criteria. Flag "RecordOnly" defines whether a record-only criteria is returned (False=record-field;True=record only). Flag "UseEqual" lets you select whether an equal sign is prepended to the criteria(for use in the worksheet).


[Home][Previous][Next]