jptechon
(jptechon)
November 5, 2022, 4:10pm
1
Hi,
i defined below sql in schema:
select TASK_LIST_DT_SYS, count(*) as TTL_NO from TASK_LIST_TBL
where {where}
group by TASK_LIST_DT_SYS
then I new newdataset as below to get data
srcData := Serviceschema.NewDataset(Connection,‘TASK_COUNT_VIEW’,[],wb.Xml);
However, if I put the field not in select statement, it show error that complain that field cant be in the where clause. However that field is in the task_list_tbl.
If I need usae a field in where clause which not in the select statement. How can I do that?
Please advise
Joe
EvgenyK
(Evgeny Karpov)
November 7, 2022, 10:29am
2
Hi,
this is as expected.
By security reasons we disallow this case by default.
Check TDataAbstractService.AllowAllFieldsInDynamicWhere property. Here you can change default behavior.
jptechon
(jptechon)
November 8, 2022, 3:56pm
3
I already set this one but still show this error.
Please advise.
EvgenyK
(Evgeny Karpov)
November 9, 2022, 6:42am
4
Hi,
Some overloads of NewDataset
have AllowAllFieldsInDynamicWhere
parameter.
use it and set that parameter to True
.
function NewDataset(const aConnection: IDAConnection; const aName: string;
aDynSelectFields: array of string;
aWhereClause: UnicodeString;
aStatementName: string='';
OpenIt: boolean = false;
AlwaysGenerateDynamicWhereStatement: Boolean=False;
AllowAllFieldsInDynamicWhere: Boolean = False;
aSortColumnName: string = '';
aSortAscMode: boolean = True;
aMaxRecords: Integer = -1;
aConnectionType: string=''): IDADataset; overload;