DynamicWhere issue with Namespace error 9.2.101.1295

Just upgraded to Tokyo and DA 9.2.101.1295 from Berlin and DA 9.1.99.1273 .

My dynamic where’s are not working. I’m getting a Namespace error.

The exception thread goes through

uDAWhere.pas -> getXml
uROOpenMMLImpl -> AddAttribute -> fNode.attributes.setNamedItem(attr);
uROXDOM_2_3 -> SetNamedItem -> if FNamespaceAware then raise ENamespace_Err.create(‘Namespace error.’);

Is this a new setting I have to set? What sets FNamespaceAware? I have not used namespaces in Delphi.

can you show your Dynamic where code and generated XML, pls?
you can post it here or drop email directly to support@

Sure, most of the code I got from a demo a while back.

Setup types/functions:

type
TFldOperator = record
FldName: AnsiString;
Display: AnsiString;
LogOper: TDABinaryOperator;
Oper: TDABinaryOperator;
DType: TDADataType;
Value: Variant;
end;
arFldOper = Array of TFldOperator;

procedure AddExpression(var fExpr: arFldOper; sFldName: AnsiString; iLogOper,iOper: TDABinaryOperator; DataType: TDADataType; Value: Variant);
var sDisplay: AnsiString;
begin
SetLength(fExpr, Length(fExpr) + 1);
fExpr[High(fExpr)].FldName := sFldName;
fExpr[High(fExpr)].Display := sDisplay;
fExpr[High(fExpr)].LogOper := iLogOper;
fExpr[High(fExpr)].Oper := iOper;
fExpr[High(fExpr)].DType := DataType;
fExpr[High(fExpr)].Value := Value;
end;

function GetDynamicWhere(fExpr: arFldOper): TDAWhereExpression;
var i,j: integer;
L, R, Where, Expr: TDAWhereExpression;
aExpr: Array of TDAWhereExpression;
Lst: TStringList;
DT: TDADataType;
NeedNot: Boolean;
LogOper: TDABinaryOperator;
daWB: TDAWhereBuilder;
begin
daWB := nil;
Where := nil;
Result := nil;

try
for i := Low(fExpr) to High(fExpr) do begin
if (daWB = nil) then daWB := TDAWhereBuilder.Create();

  NeedNot := False;
  LogOper := fExpr[i].Oper;
  DT      := fExpr[i].DType;

  if VarIsNULL(fExpr[i].Value) then begin
    R := daWB.NewNull();

    if (LogOper = dboNotEqual) then begin
      LogOper := dboEqual;
      NeedNot := True;
    end;
    end
  else begin
    case LogOper of
      dboLike: R := daWB.NewConstant('%'+fExpr[i].Value+'%', DT);
      dboIn: begin
               Lst := TStringList.Create;
               try
                 Lst.CommaText := fExpr[i].Value;
                 SetLength(aExpr,Lst.Count);
                 for j:=0 to pred(Lst.Count) do begin
                   aExpr[j] := daWB.NewConstant(Lst[j], DT);
                 end;
               finally
                 Lst.Free;
               end;
               if (Length(aExpr) > 0) then R := daWB.NewList(aExpr);
             end
      else R := daWB.NewConstant(fExpr[i].Value, DT);
    end;
  end;

  L    := daWB.NewField('', fExpr[i].FldName);
  Expr := daWB.NewBinaryExpression(L, R, LogOper);

  if (NeedNot) then Expr := daWB.NewUnaryExpression(Expr, duoNot);

  if Assigned(Where)
    then Where := daWB.NewBinaryExpression(Where, Expr, fExpr[i].LogOper)
    else Where := Expr;
end;

if Assigned(daWB) then Result := Where;

finally
daWB.Free;
end;
end;

Usage:

var conn: IDAConnection;
tdMPDefault: IDADataset;
aDynSelectFields: array of String;
fExpression: arFldOper;
WB: TDAWhereBuilder;
begin
conn := GetNewConnection(sConn,sCoreDB);
WB := TDAWhereBuilder.Create;
SetLength(fExpression, 0);
SetLength(aDynSelectFields,0);
AddExpression(fExpression,‘FIID’,dboAnd,dboEqual,datInteger,iFIID);
AddExpression(fExpression,‘MEMerchSettleFeeRej’,dboAnd,dboEqual,datInteger,MERCH_DEFAULT);
AddExpression(fExpression,‘MPPrimaryAccount’,dboAnd,dboEqual,datBoolean,True);
WB.Expression := GetDynamicWhere(fExpression);

tdMPDefault := ATICoreSchema.NewDataset(conn, ds_GetMPDefault,aDynSelectFields,WB.XML);

Thanks, logged as bugs://77618

update uDAWhere.pas as

function TDAWhereBuilder.ExpressionToXmlNode(
  const aExpression: TDAWhereExpression): IXMLNode;
..
  doc := NewROXmlDocument;
  {$IFDEF NEXTGEN} //<<<<<<<<<<<< changed

bugs://77618 got closed with status fixed.

Pending further testing, this works, thank you very much!