x++


AX 2012 how to set args record datasource in X++


Can anyone tell me what should I do in X++ to get a NOT null value from args.record().datasource() method after executing the following statements:
PurchTable purchTable;
args.record(purchTable);
if(args.record().datasource()) //this condition fails because of null value
{
//I have to reach here
}
I know that the same code works fine when it is called from Form but my scenario is that I have to execute this code from within X++. Please help!
args.record().datasource() will retrieve a form datasource. Here, you are using a table buffer only. That's why you don't have anything.
If you want to retrieve the table buffer, you might go this way:
PurchTable purchTable;
PurchTable argPurchTable;
select firstOnly purchTable;
args.record(purchTable);
if (args.record() && args.dataset() == tableNum(PurchTable))
{
argPurchTable = args.record();
//do something
}
Regards,
Geoffrey

Related Links

Cancel Sales order packing slip through x++
Transferring open account records between customers
How to make sure that a form is only opened once?
Extend system menu in Dynamics AX 2012?
How to show selected items of certain table on the different table in Dynamics AX 2012?
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

Categories

HOME
windows
grok
delphi-7
spark-streaming
fuelux
merge
pagination
requirements
cq5
echo
modal-dialog
computer-science
arangodb
fabric.io
vimdiff
watson-conversation
redis-sentinel
modbus-tcp
event-sourcing
atlassian-stash
google-content-api
boost-icl
cgbitmapcontext
corpus
quantlib
finagle
alm
aws-codecommit
recurring-events
postback
paragraph
jbutton
catch-unit-test
gojs
sharding
python-import
apiary.io
cin
jvmti
news
doc
watchface
branching-and-merging
postgresql-8.4
softmax
jide
mesosphere
ovf
robomongo
truezip
git-flow
headless
mach-o
vibrate
shinobi
restore
visual-studio-2008-sp1
cubism.js
builtins
reporting-services-2012
jodd
rspec2
expectations
gogs
http-status-code-401
php-socket
upx
pypiserver
viola-jones
user-permissions
umlgraph
mass-assignment
cosine-similarity
filesplitting
addressing-mode
contrast
sql-scripts
unix-socket
with-statement
build-script
cuba
extjs2
multiautocompletetextview
ora-06550
bin
hibernate-entitymanager
model-driven-development
neos-server
ui-select2
abstract-data-type
superscrollorama
curb
httponly
htdocs
matlab-load
google-floodlight
tournament
qglwidget
luajava
zen
cfwindow
echo3
software-lifecycle

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