VendOpenTrans网格上的特定尺寸 [英] Specific Dimension on VendOpenTrans Grid
问题描述
我的任务是在VendOpenTrans中添加具有特定维度的字段.我在VendOpenTrans表的DimensionAttributeValueSet,DimensionAttributeValueSetItem,DimensionAttributeValue和DimensionAttribute中添加了数据源.
My task is to add a field in VendOpenTrans with a specific Dimension. I have added to my DataSources in VendOpenTrans tables DimensionAttributeValueSet, DimensionAttributeValueSetItem, DimensionAttributeValue and DimensionAttribute.
在它们的属性中,我使用InnerJoin LinkType进行了联接(联接源)(我在这里尝试了所有选项).然后,从DimensionAttributeValueSetItem-> DisplayValue(字段名称)在网格上添加一个字段.
In their properties I have made joins (join source) with InnerJoin LinkType (I tried all of the options here). Then I have add a field on my grid from DimensionAttributeValueSetItem -> DisplayValue (field name).
现在在VendOpenTrans的ExecuteQuery方法中,添加代码:
And now in ExecuteQuery method of VendOpenTrans I add a code:
public void executeQuery()
{
/*QueryBuildRange dimensionAttributeValueSetRange;
;
dimensionAttributeValueSetRange = this.query().dataSourceTable(tableNum(DimensionAttribute)).addRange(fieldNum(DimensionAttribute, Name ));
dimensionAttributeValueSetRange.value('MyDimensionName');
super();
}
此操作的最终结果是我有一个新的过滤器,具有我的尺寸.因此,我在网格记录中没有看到在该维度上具有空值的记录.
The final result of this is that I have a new filter with my dimension. So I don't see on my grid records that have an empty value in this dimension.
我要实现的事情是显示"MyDimensionName"的值(如果已填充),但是当未记录时,应仅显示一个空值...
The thing that I want to achieve is to show the value of "MyDimensionName" if It's filled but when It's not record should be shown with just an empty value...
我花了很多小时,但仍然没有解决...
I spend on this many many hours and I still didn't work it out...
推荐答案
在AX 2012中对特定维度进行选择是很棘手的,但是这种方法可能会有所帮助:
Selecting on specific dimension in AX 2012 is tricky beyond reason, but this method may be of help:
static void queryDimensionUpdate(LedgerDimensionAccount _dimension, Query _q, str _dataSourceName, FieldName _field = fieldStr(GeneralJournalAccountEntry,LedgerDimension))
{
DimensionStorageSegment segment;
DimensionStorage storage = DimensionStorage::findById(_dimension);
DimensionProvider provider = new DimensionProvider();
DimensionAttributeValue value;
Name name;
int segmentCount;
int s;
if (storage)
{
segmentCount = storage.segmentCount();
for (s = 1; s <= segmentCount; s++)
{
segment = storage.getSegment(s);
if (segment.parmDimensionAttributeValueId())
{
name = DimensionAttribute::find(DimensionAttributeValue::find(segment.parmDimensionAttributeValueId()).DimensionAttribute).Name;
//info(strFmt('%1: %2, %3', name, segment.parmDisplayValue(), segment.getName()));
provider.addAttributeRangeToQuery(_q, _dataSourceName, _field, DimensionComponent::DimensionAttribute, segment.parmDisplayValue(), name);
}
}
}
}
给出一个具有适当值的_dimension
集合以进行搜索,例如011010-103-101--,它将更新查询_q
并选择与以下内容相关的给定尺寸(示例中为011010、103和101)数据源_datasourceName
和字段_field
.
Given a _dimension
set with proper values to search for, say 011010-103-101--, it will update the query _q
selecting for the dimensions given (011010, 103 and 101 in the example) related to the datasource _datasourceName
and field _field
.
It does so by iterating _dimension
segments for values, then updating the query using the DimensionProvider.addAttributeRangeToQuery
method.
这篇关于VendOpenTrans网格上的特定尺寸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!