x++


Getting the index of an array element of EDT Dimension


I need to write a job where i could fetch the index of an array element of EDT Dimension
e.g. In my EDT Dimension i have array elements A B C when i click over them for properties I see the index for A as 1, B as 2 and C as 3. Now with a job ui want to fetch the index value. Kindly Assist.
I'm not sure if I did understand the real problem. Some code sample could help.
The Dimensions Table has some useful methods like arrayIdx2Code.
Maybe the following code helps:
static void Job1(Args _args)
{
Counter idx;
Dimension dimension;
DimensionCode dimensionCode;
str name;
;
for (idx = 1; idx <= dimof(dimension); idx++)
{
dimensionCode = Dimensions::arrayIdx2Code(idx);
name = enum2str(dimensionCode);
// if (name == 'B') ...
info(strfmt("%1: %2", idx, name));
}
}
I found a way but still looking if there is any other solution.
static void Job10(Args _args)
{
Dicttype dicttype;
counter i;
str test;
;
test = "Client";
dicttype = new dicttype(132);//132 here is the id of edt dimension
for (i=1;i<=dicttype.arraySize();i++)
{
if ( dicttype.label(i) == test)
{
break;
}
}
print i;
pause;
}
Array elements A B C from your example are nothing else but simple labels - they cannot be used as identifiers. First of all, for user convenience the labels can be modified anytime, then even if they aren't, the labels are different in different languages, and so on and so forth.
Overall your approach (querying DictType) would be correct but I cannot think of any scenario that would actually require such a code.
If you clarified your business requirements someone could come up with a better solution.

Related Links

AllowEdit doesn't work properly in Dynamics AX
AX 2012 how to set args record datasource in X++
Clients seem to be running old (buggy) code after XPO project import
Number sequence AX 2012
SSRS MS words report with page break
How can you get a detailed error descriptions in Dynamics AX?
How to get the length of an array?
X++ loop through lines in grid control
Concatenating row values in x++
How do you access a macro in the AOT macro node?
How can I set the Backgoundcolor of an AX2012 Action Pane Button
How to Edit address using X++ in AX 2012
Number sequence issue Ax 2012?
Find code that's running in a Batch Job
What is the _isMexican boolean for in the Global::Checkpower method?
AlwaysOnTop property not behaving properly

Categories

HOME
android
service-worker
amp-html
formal-languages
pda
ns-3
static
knitr
vxml
tail
visual-studio-emulator
iis-6
p2p
jquery-ui-sortable
activecollab
mxgraph
renjin
screen-readers
internationalization
alpacajs
chargify
google-content-api
google-container-registry
soci
symfony-console
sse
nodemcu
boost-icl
jquery-ias
pagespeed
dataflow-diagram
visual-studio-extensions
tiki-wiki
android-sharedpreferences
outliers
exchangewebservices
paperjs
vex
userdefaults
testbed
android-sugarorm
openwhisk
dynamic-jasper
processwire
zoomify
git-rewrite-history
opensmpp
visa
xmldocument
phpdbg
dynamic-linq
dbcontext
openblas
aquamacs
azure-cli
mach-o
template-toolkit
cudd
omxplayer
builtins
installshield-2010
cifilter
tracker-enabled-dbcontext
cda
cortex-m
halcon
invoke-sqlcmd
directdraw
decimalformat
fiware-monitoring
flock
morton-number
xvim
ons-api
sha512
mirror
avahi
mass-assignment
iiop
android-vibration
ssis-data-flow
iso-prolog
genymotion-call
insight.database
template-deduction
accesscontrolexception
mt4j
windows-phone-8-sdk
mysql-error-2013
android-sdk-2.3
device-width
mkv
kqueue
convention
screen-size
jquery-tools
filemerge
hbm2java
opml
blender-2.49
pagemethods
spread
asynchronous-wcf-call
wysiwym
todos
fault-tolerance
online-storage

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App