Query x++ with Dimension

Hi, all.
Help me, please

Axapta 4.0
Me need build query by using QueryBuildDataSource
SQL Query - Select * from Claim where Dimension4_ <> ‘KZR’ and Dimension4_ <> ‘EU’ ) and T_RepairId=‘ЗР033586’

I tried a variety of ways, but unfortunately they do not work

qbds = Query.addDataSource(tablenum(Claim));
qbds.addRange(fieldNum(Claim,T_RepairId)).value(sysQuery::value(“ЗР033586”));
qbr = qbds.addRange(fieldId2Ext(fieldNum(Claim,Dimension),4));

qbr.value(strFmt(’((%1.%2 != “%4”) && (%1.%3 != “%5”))’,
qbds.name(),
fieldid2name(tablenum(Claim), fieldid2ext(fieldnum(Claim,Dimension), Dimensions::code2ArrayIdx(SysDimension::Purpose))),
fieldid2name(tablenum(Claim), fieldid2ext(fieldnum(Claim,Dimension), Dimensions::code2ArrayIdx(SysDimension::Purpose))),
“KZR”,
“EU”));

Result -
SELECT * FROM Claim WHERE ((T_RepairId = N’ЗР033586’)) AND ((((Claim_1.Dimension[4] != “KZR”) && (Claim_1.Dimension[4] != “EU”))))

Error extended range query: expected right parenthesis next to the 27.

qbr.value(strFmt(’((Dimension[4] != %1) && (Dimension[4] != “%2”))’,
“KZR”,
“EU”));

Result -
SELECT * FROM Claim WHERE ((T_RepairId = N’ЗР033586’)) AND ((((Dimension[4] != “KZR”) && (Dimension[4] != “EU”))))

Error extended range query: expected right parenthesis next to the 14

qbr.value(strFmt(’((Dimension4_ != “%1”) && (Dimension4_ != %2"))’,
“KZR”,
“EU”));

Result
SELECT * FROM Claim WHERE ((T_RepairId = N’ЗР033586’)) AND ((((Dimension4_ != “KZR”) && (Dimension4_ != “EU”))))
Error extended range query: .

qbr.value(strFmt(’((Claim.Dimension4_ != “%1”) && (Claim.Dimension4_ != “%2”))’,
“KZR”,
“EU”));
Result
SELECT * FROM Claim WHERE ((T_RepairId = N’ЗР033586’)) AND ((((Claim.Dimension4_ != “KZR”) && (Claim.Dimension4_ != “EU”))))
Error extended range query: Claim.Dimension4_ is not correct pair datasource.field near 29

qbr.value(strFmt(’((%1.Dimension4_ != “%2”) && (%1.Dimension4_ != “%3”))’,tableid2name(tablenum(Claim)),
“KZR”, “EU”));
Result -
SELECT * FROM Claim WHERE ((T_RepairId = N’ЗР033586’)) AND ((((Claim.Dimension4_ != “KZR”) && (Claim.Dimension4_ != “EU”))))
Error extended range query: Claim.Dimension4_ is not correct pair datasource.field near 29

qbr.value(strFmt(’((%1.Dimension[4] != “%2”) && (%1.Dimension[4] != “%3”))’,tableid2name(tablenum(Claim)),
“KZR”, “EU”));

Result -
SELECT * FROM Claim WHERE ((T_RepairId = N’ЗР033586’)) AND ((((Claim.Dimension[4] != “KZR”) && (Claim.Dimension[4] != “EU”))))
Error extended range query: Claim.Dimension is not correct pair datasource.field near 25.

qbr.value(strFmt(’((%1 != “%3”) && (%2 != “%4”))’,
SysDictTable::fieldnameSQL(tablenum(Claim), fieldid2ext(fieldnum(Claim, Dimension), 4), FieldNameGenerationMode::FieldList), SysDictTable::fieldnameSQL(tablenum(Claim
), fieldid2ext(fieldnum(Claim
, Dimension), 4), FieldNameGenerationMode::FieldList),
“KZR”, “EU”));

Result - SELECT * FROM Claim WHERE ((T_RepairId = N’ЗР033586’)) AND ((((DIMENSION4_ != “KZR”) && (DIMENSION4_ != “EU”))))

Error extended range request

Hello,

i dint go thru with your all cases but i think you will find your answer here ,

post is of 2009 but you will get idea from it.