Where: String;
The Where property determines a part of query where the whole condition of element selection for dimensions is specified.
If the property value was obtained in a separate variable and the expression is modified in the variable, then it is required to rewrite property value to apply changes:
Public Class SQLCallback: Object, ISQLCallback
Sub BeforeConstruction(Components: ISQLComponents);
Var
Where: String;
Begin
Where := Components.Where;
//...
//Modification of Where
//...
Components.Where := Where;
End Sub BeforeConstruction;
Sub AfterConstruction(Var SQL: String);
Begin
End Sub AfterConstruction;
End Class SQLCallback;
A particular parts where conditions to select elements of a specific dimension are specified, can be obtained using the ISQLComponents.Condition property.
The specified class is a handler of query generation for cube data extraction. The class should be saved to the unit and assign it as a handler to cube data source using the IStandardCubeDataset.SetCallback.
Public Class SQLCallback: Object, ISQLCallback
Sub BeforeConstruction(Components: ISQLComponents);
Var
i: Integer;
Condition: ISQLCondition;
Begin
Debug.WriteLine("Where: " + Components.Where); Components.Where := Components.Where;
Debug.WriteLine("ConditionCount: " + Components.ConditionCount.ToString);
For i := 0 To Components.ConditionCount - 1 Do
Condition := Components.Condition(i);
Debug.WriteLine("Condition " + Condition.Condition);
Debug.Indent;
Debug.WriteLine("Fields: " + Condition.Fields);
Debug.WriteLine("TempTable: " + Condition.TempTable);
Debug.WriteLine("TempTableAlias: " + Condition.TempTableAlias);
Debug.WriteLine("TempTableAttrLinkedFields: " + Condition.TempTableAttrLinkedFields);
Debug.WriteLine("TempTableFields: " + Condition.TempTableFields);
Debug.WriteLine("TempTableHasNulls: " + Condition.TempTableHasNulls.ToString);
Debug.WriteLine("TempTableRecCount: " + Condition.TempTableRecCount.ToString);
Debug.Unindent;
End For;
Debug.WriteLine("TableAlias: " + Components.TableAlias);
End Sub BeforeConstruction;
Sub AfterConstruction(Var SQL: String);
Begin
End Sub AfterConstruction;
End Class SQLCallback;
On executing the BeforeConstruction procedure, all parts of generated query will be displayed to development environment console. If required, any block can be uncommented and a part of query can be modified. Fully generated query will be displayed on executing the AfterConstruction method.
See also: