Query Extended Range Failure in AX 2009..?

Hi There,

I am getting an error when DAX exesuting the below code.

qbr = qbdsInventDimSalesLine.addRange(fieldNum(InventDim,configId));

qbr.value(strfmt(’((%1.%2 == %2) && (%1.%3 == %3) && (%1.%4 == %4))’,
qbdsInventDimItem.name(),
fieldStr(InventDim, configId),
fieldStr(InventDim, inventColorId),
fieldStr(InventDim, inventSizeId)

Error :

Query Extended Range Failure :

qbdsInventDimItem.Config is not a valid datasource.field pair near Pos 33.


Is there any way to write the above extended query as a normal quey…to make the same logic work…?

Thanks In Advance.
Bobby

You can easily write it in select statement:

While select datasourcebuffer

join inventdim

where datasourcebuffer.inventdimid == inventdim.inventdimid

&& inventdim.configid == “yourconfigid”

etc…

You added a range to qbdsInventDimSalesLine but you use the name of qbdsInventDimItem. That’s highly suspicious.

Hi Martin,

Thank you for the reply.

I want to match the dimensions of qbdsInventDimSalesLine combination with another qbdsInventDimItem combination.

So, I have added range to qbdsInventDimSalesLine but I am using name of qbdsInventDimItem.

Thaks,
Bobby

Hi Vishal,

Thank you for the reply, I will try that too.

Bobby

I would strongly recommend prefixing all fields with datasource names. Also, do you have any idea why the error talks about qbdsInventDimItem.Config instead of qbdsInventDimItem.ConfigId?

If you can’t find the problem by yourself, please give us the complete query, not just that one range.

Hi Martin,

The same piece of code of that query is working fine in our PROD and DEV machine but don know why it is erroring out only in TEST.

I verified that I have the same data and code in DEV and TEST.

I tried to run this class after resetting my usage data and SysLastValue table. I tried with AOS restart but no luck.

FYI : - I noticed that the kernel version for DEV is one build lower than the TEST.

Thanks,

Bobby

Hi Guys,

Thanks for all of your help and Ideas.

Finally I fixed this issue using “qbds.addLink( )”

I just replaced the query extended range and used the addLink( ) and it worked fine for me again I am saying it may be worked as per my requirement.

qbr = qbdsInventDimSalesLine.addRange(fieldNum(InventDim,configId));

qbr.value(strfmt(’((%1.%2 == %2) && (%1.%3 == %3) && (%1.%4 == %4))’,
qbdsInventDimItem.name(),
fieldStr(InventDim, configId),
fieldStr(InventDim, inventColorId),
fieldStr(InventDim, inventSizeId)

Error :

Query Extended Range Failure :

qbdsInventDimItem.Config is not a valid datasource.field pair near Pos 33.

Sol :

qbdsInventDimSalesLine.addLink(fieldNum(InventDim,configId),fieldNum(InventDim,configId), #qbdsInventDimItem);

qbdsInventDimSalesLine.addLink(fieldNum(InventDim,inventColorId),fieldNum(InventDim,inventColorId), #qbdsInventDimItem);

qbdsInventDimSalesLine.addLink(fieldNum(InventDim,inventSizeId),fieldNum(InventDim,inventSizeId), #qbdsInventDimItem);

it worked for me.

Hi Bobby,

I have same Issue.please check the Following code.

qbs.addRange(fieldnum(Prarenttable,ID)).value(strFmt(’((%1 == %3)||(%2 == %4))’,fieldStr(Prarenttable,ID),fieldStr(Prarenttable, ValueID),sysquery::valueNotEmptyString(),sysquery::valueNotEmptyString()));

Error :Query extended range failure: Syntax error near 11.

Thanks in advance,