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

Determine the number of affected rows by an update_recordset call in Dynamics 4.0?
how to protect the x++ source code
About Data Dictionary
setTimeOut and local function
Passing FromControl in a lookup override method
Reference control from datamethod in generated design
Extended EDT does not compare dates
How to display a tooltip in Dynamics AX 4.0?
how to disable intellisense in ax2012's code editor?
How do you “Run” a class
General quesions about Dynamics Ax
Convert date into julian date
How to change the level of AX info messages
X++ unbound control
WeekOfYear in X++ using .net lib
How to tell what module has called the program

Categories

HOME
fuelux
dns
swt
jwplayer
solaris
spring-data-mongodb
permissions
cakephp-3.4
regular-language
interpolation
tvos
crystal-lang
accessibility
okhttp
little-proxy
dkim
fhir
redis-sentinel
ipmitool
frequency-distribution
qsqlquery
azure-powershell
easyphp
oledb
poedit
guzzle
hta
exit
tosca
dynamically-generated
draft-js-plugins
google-cloud-print
bulletphysics
amazon-quicksight
wacom
hard-drive
android-maps-extensions
yowsup
latitude-longitude
openerp-7
google-earth-engine
ideascript
ods
health-monitoring
watchface
apriori
datacachefactory
android-exoplayer
wc
optimizely
amq
context-switch
wpas
gameplay-kit
filenet
android-instrumentation
docpad
redistributable
greatest-n-per-group
signalr.client
beamer
drawstring
nservicebus5
riot
cortex-m
state-restoration
character-replacement
video-player
extjs-grid
amiga
osc
delayed-execution
packet-sniffers
mruby
addressing-mode
universal-image-loader
rmysql
build-script
vbe
multitasking
mysql-error-1044
script#
nevron
mantle
fsevents
catransform3d
winmain
umra
msr
cloudfiles
presentation-layer
squishit
cardspace

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