I wrote the following job - to learn more about how AX and X++ work, but it is driving me crazy.
It is having problems with this line below: qbr2 = qbds1.addRange(fieldNum(dimensionAttributeValueSetItem,DisplayValue));
When I run it, it gives a critical stop and says: Invalid range. It is a valid field in DimensionAttributeValueSetItem, but for some reason it doesn't think so.
I have been over my program multiple times and cannot find any error - what would make it give an error like that? What am I missing?
static void DantestInventTable(Args _args)
structOutput = new struct
+ "str DisplayValue;"
query = new Query();
qbds1 = query.addDataSource(TableNum(InventTable));
qbr1 = qbds1.addRange(fieldNum(inventTable,SemRevenueType));
qbr2 = qbds1.addRange(fieldNum(dimensionAttributeValueSetItem,DisplayValue));
qbds2 = qbds1.addDataSource(TableNum(DimensionAttributeValueSetItem));
queryRun = new queryRun(query);
// the If condition checks to see that the query is running. If not, it will not execute.
//the while loops over the InventTable in search of the information needed.
inventTable = queryRun.get(tableNum(InventTable));
dimensionAttributeValueSetItem = queryRun.get(tableNum(DimensionAttributeValueSetItem));
It looks like you have set the range with a field in the dimensionAttributeValueSetItem table, but the QueryBuildDataSource (qbds1) is the inventtable.
As you can tell, I am new at this. How do I add the range for the dimensionAttributeValueSetItem as well at the inventTable? I have been looking all over the web, and can't find anything that explains this very well.
figured that part out - played with it some more!
Thats great. Sometimes it just takes experimentation, and alot of Bing/Google.
I just wish there was more about some of these topics in Bing/Google. Have to do a ton of searching for the little gems that are hidden out there - and with many blogs reposting the same post - can get very frustrating. I do the Web searches first and when I can't find what I need I then post here asking for help. So far this Forum has helped me with the three major problems I couldn't solve any other way. You all are a great help!