Other recent Dynamics AX Blog postings

Donnerstag, August 30, 2007

Label for query range cannot be modified in AX 5.0

I've now checked this function and I have to say that it still doesn't work. If you change the label for a query range, AX 5.0 will give you an error message, too.

This is a follow up to a previous post: http://axaptafreak.blogspot.com/2007/07/label-for-query-range-cannot-be.html

1 Kommentar:

Rogério Costa hat gesagt…

I solved this problem with these steps:

1 - Create a field in table with the label that you want.

2 - Set this field (previously created) as a Field Range in the Query.

3 - In a query, set the value of this range into a correct range that you want to consider, by code.
i.e.

this.query().dataSourceTable(TableNum(YOURDATASOURCE)).addRange(fieldNum(YOURDATESOURCE, FieldtoConsider)).value(this.query().dataSourceTable(TableNum(YOURDATASOURCE)).findRange(fieldNum(YOURDATASOURCE, FIELDCREATEDTOGETVALUE)).value());

4 - After this, you have the correct value in Correct Range, but you need to clear the range used as "Auxiliar range" to not influence in your execution. Do this after that you set value, by code.
i.e.:

this.query().dataSourceTable(TableNum(YOURDATASOURCE)).clearRange(fieldNum(YOURDATASOURCE, FIELDCREATEDTOGETVALUE));

After this, you can work with the range anywhere you want.

I did this in a report, overwriting the Fetch Method. Remember that in a visual query execution, you set the Range only to get this value and set into a correct Range, by coding.

Finish.