Hi,
I found some useful information regarding the updation of the updated current row record from the "Dynamics AX tools and tutorials" blog.
It may be helpful to someone.
In order to update the display options for a specific row that you updated, you can use the clearDisplayOption method on the FormDataSource class.
So, after calling
yourDS_ds.reread();
yourDS_ds.refresh();
you should call
yourDS_ds.clearDisplayOption(yourDS);
This should do the trick and update the color of the row.
Regards,
/Ashlesh
Wednesday, December 29, 2010
Friday, November 19, 2010
Add Label Files to Repository
Hi,
To use Labels (*.ald) files in Version Control system in AX 2009. It is required to do below steps:
1. Go to Tools/Development Tools/Version Control/Setup/Add Label File.
2. In the form shown, type some description for VSS history records and browse the *.ald file which contains your labels.
3. Click "OK".
4. Go to Tools/Development Tools/Version Control/Synchronize. and synchronize the Label Files.
Now label files are added to your version control system (Repository) and ready to use through your AOT.
Regards,
/Ashlesh
To use Labels (*.ald) files in Version Control system in AX 2009. It is required to do below steps:
1. Go to Tools/Development Tools/Version Control/Setup/Add Label File.
2. In the form shown, type some description for VSS history records and browse the *.ald file which contains your labels.
3. Click "OK".
4. Go to Tools/Development Tools/Version Control/Synchronize. and synchronize the Label Files.
Now label files are added to your version control system (Repository) and ready to use through your AOT.
Regards,
/Ashlesh
Tuesday, November 9, 2010
Guide for Container in MorphX
Hi,
I found a good article from Axaptapedia related to Container datatype in MorphX.
Containers are a basic form of linked lists. Container functions that you might need are conins, conpoke, conpeek, condel and connull.
A container can store almost any datatype, except of objects. You can store a record/tablebuffer and BinData as a blob inside of a container.
One use of containers is to pass multiple variables between objects using a single call. This is particularly useful when considering 3-tier performance, as each call across a tier can be quite expensive. In that case, putting your variables into one container and passing that in a single call will gain some performance.
Another use is to eliminate some tedious coding practices when writing display methods for report labels. If you have to return values from tables just use a container to store them all then conpeek them out using a global incremental pointer. This pointer can be reset in the executeSection of your Design then use the same method for the DataMethod of your report label something like
To declare a container simply prefix the container name with keyword container.
Inserting data
I found two methods of inserting data into a container, one is using conins(container, start location, value1,...) same syntax can be used for conpoke(container, start location, value1,...). Using conpoke will actually modify data at that location as opposed to inserting, the idea is that initially you can build your container with conpoke but if your container will need data added then use conins which will insert the data at specified location and bump the rest of the data.
Appending data
The normal way to append data to variable is
The best way for appending data to a container is:
Compare
Its also possible to compare 2 containers with each other using the normal operators ==, >, >=, <, <=, !=. Comparing containers results in comparing the content, the first element of container 1 will be compared with the first element of container 2, and so on..... until the comparision gets a result!
Display a container
for displaying the content and structure of a container, use the static-method conview of the class global. conview creates a formRun-Object showing the container as a tree. This formRun can be shown as a normal form or it can be used as lookup-form.
This whole thing is especially tricky in cases where you need variable-length containers which you usually create dynamically: This actually scales rather bad. However, there is a rather simple trick you can use if you run into this problem: The integrated List class does have a very nice packed format, which is just about what you need:
I found a good article from Axaptapedia related to Container datatype in MorphX.
Container
From Axaptapedia
Jump to: navigation, search
[edit] Containers
DescriptionContainers are a basic form of linked lists. Container functions that you might need are conins, conpoke, conpeek, condel and connull.
A container can store almost any datatype, except of objects. You can store a record/tablebuffer and BinData as a blob inside of a container.
One use of containers is to pass multiple variables between objects using a single call. This is particularly useful when considering 3-tier performance, as each call across a tier can be quite expensive. In that case, putting your variables into one container and passing that in a single call will gain some performance.
Another use is to eliminate some tedious coding practices when writing display methods for report labels. If you have to return values from tables just use a container to store them all then conpeek them out using a global incremental pointer. This pointer can be reset in the executeSection of your Design then use the same method for the DataMethod of your report label something like
display real showValue() { pointer++; return any2real(conpeek(yourcontainer,pointer)); }Declaration
To declare a container simply prefix the container name with keyword container.
static void Job33(Args _args) { container contest; ; }
Inserting data
I found two methods of inserting data into a container, one is using conins(container, start location, value1,...) same syntax can be used for conpoke(container, start location, value1,...). Using conpoke will actually modify data at that location as opposed to inserting, the idea is that initially you can build your container with conpoke but if your container will need data added then use conins which will insert the data at specified location and bump the rest of the data.
static void Job33(Args _args) { container contest; ; contest =conpoke(contest,1,"bla",3); //contest = conins(contest,1,"bla",3); print conpeek(contest,2); pause; }In the above I use conpoke to insert two values starting at location 1 into contest. So after this our container will ... contain :) value "bla" at location 1 and value 3 at location 2. Data type for values is anytype. conpeeek returns anytype data type.
Appending data
The normal way to append data to variable is
// e.g. using a string testString = testString + 'append data' // e.g. using a container contest = contest + ['next value'];A problem for this operation with large containers will discussed in the next chapter.
The best way for appending data to a container is:
// use this way to append data contest += ['next value']; // instead of this contest = contest + ['next value']The += is much faster and needs less memory than the normal way...
Compare
Its also possible to compare 2 containers with each other using the normal operators ==, >, >=, <, <=, !=. Comparing containers results in comparing the content, the first element of container 1 will be compared with the first element of container 2, and so on..... until the comparision gets a result!
Display a container
for displaying the content and structure of a container, use the static-method conview of the class global. conview creates a formRun-Object showing the container as a tree. This formRun can be shown as a normal form or it can be used as lookup-form.
static void testContainer(Args _args) { container testContainer1,testContainer2; ; testContainer1 = [ 'Hello World', today(), DocumentStatus::Invoice ]; testContainer2 = [ CustTable::find('4004'), testContainer1, 'blabla' ); conview(testContainer1); global::conview(testContainer2); }
[edit] Performance considerations
One important detail about containers is the fact, that they are static structures. You cannot modify a container in-place, instead each addition or deletion has to iterate over the entire structure to copy all values into a newly allocated one. So every container manipulation has a runtime of O(n). Thus, whenever possible, read and write containers as a batch:// writing a container packedClass = [ version, var1, var2, var3 ]; // reading a container [ version, var1, var2, var3 ] = packedClass;I cannot tell how this is for reading operations, I suspect that they're O(1) much like arrays, but I wouldn't bet anything on it.
This whole thing is especially tricky in cases where you need variable-length containers which you usually create dynamically: This actually scales rather bad. However, there is a rather simple trick you can use if you run into this problem: The integrated List class does have a very nice packed format, which is just about what you need:
static container List2Container(List list) { container result; result = list.pack(); switch (conpeek(result, 1)) { case 1: return condel(result, 1, 3); default: throw error(strfmt("The List version %1 is not suppported.", conpeek(result, 1))); } }I had performance problems in this respect with containers having 50+ elements which have to be assembled dynamically (for various reasons not important here). Changing to a list and converting it into a container in a single batch is at least one magnitude faster there (no wonder, as appending to a list works in O(1) rather then O(n)).
Tuesday, November 2, 2010
To view newly added Item in ItemDetails form Grid
When you created the record in the InventTable form, the following tables were changed: 1. InventTable - added one line - the one you see in the grid 2. InventTableModule - added 3 lines - for Purch, Sales and Invent modules 3. InventItemLocation - added 1 line You have to import into all 3 tables. Then the records in the grid will be visible.
Regards,
/Ashlesh
Monday, October 25, 2010
Using record templates in code for Dynamics Ax 4.0.
This article deals with defaulting values from record templates through code in Dynamics Ax 4.0.
Whenever you creat a new record in the Item form, a small form opens up showing up the templates. You can choose one of the templates from which you want to the basic values like "Item Group", "Dimension Group" to be copied.(Provided you have setup a template for that table).
This comes handy to create new records further as most of the value is drawn from the template record itself. You can harness this when you do it through code also :) .... The following lines will throw light on how to do it.
1. Assume that you have the template name, then all that you need is to create a new record based on the template.
These three lines will do the job...
These three lines will do the job...
sysRecordTemplate = SysRecordTemplate::newCommon(inventTable);
sysRecordTemplate.parmForceCompanyTemplate('WMSY01'); //Template name as string
sysRecordTemplate.createRecord();
There are two kind of templates one common for the entire company and the other for specific user. In my example i have taken the company template, for the simple reason that it is valid across all accounts.
2. The above code pressumes that you might know the template name in prior. Sometimes you may want to give user a option of telling what template he wants to use. In that case we may need to create a template for him.
2. The above code pressumes that you might know the template name in prior. Sometimes you may want to give user a option of telling what template he wants to use. In that case we may need to create a template for him.
Here is the code that will enable the lookup and validate the selection. Bind these methods to the control where the user selects.
//Call this method in the init method of formSysRecordTmpTemplate VCTInitItemTemplates() { Container recordValues; ; recordValues = SysRecordTemplateTable::find(tablenum(inventTable)).Data; recordValues = condel(recordValues,1,1); //tmp1 - Global variable for lookup SysRecordTmpTemplate::insertContainer(tablenum(inventTable), tmp1, recordValues, SysRecordTemplateType::Company, true); //tmp2 - Global variable for validation SysRecordTmpTemplate::insertContainer(tablenum(inventTable), tmp2, recordValues, SysRecordTemplateType::Company, true); return tmp; }//Override the lookup methodpublic void lookup() { SysTableLookup sysTableLookup; SysRecordTmpTemplate tmp; Container recordValues; ; super(); sysTableLookup = SysTableLookup::newParameters(tablenum(SysRecordTmpTemplate), this); //Add the fields to be shown in the lookup form sysTableLookup.addLookupfield(fieldnum(SysRecordTmpTemplate, Description), true); sysTableLookup.parmUseLookupValue(false); sysTableLookup.parmTmpBuffer(tmp2); // Perform lookup sysTableLookup.performFormLookup(); }
//Override the modified method
public boolean modified()
{
boolean ret;
SysRecordTmpTemplate tmp;
container recordValues;
;
ret = super();
select firstonly tmp2 where tmp2.Description == this.valueStr();
if (!tmp2 && this.valueStr())
{
this.text('');
warning ('Invalid selection.');
return false;
}
return ret;
}
This also helps you learn usage of temporary tables for lookup's. The following line enables lookups through temporary table.
sysTableLookup.parmTmpBuffer(tmp2);
Hope now you can implement a full fledged code that will create it's record from an pre exisiting template.
Regards,
/Ashlesh
Friday, October 1, 2010
Error in pack/unpack method while using LocalMacro.CurrentList and CurrentVersion
Hi,
I faced the problem while using dialog field in my class. I have declared a dialogfield variable for EDT but while assigning the value from the dialog it is not able to keep the assigned value throughout the class where it is being used.
I found some blogs that, by the use of Local Macro (CurrentVersion and CurrentList) you can resolve this issue. But the concept of CurrentVersion is much complicated with it.
Key Point: You have to manually increase the value of CurrentVersion declared as and when you add the dialogfield into the CurrentList macro.
By using above i can able to use the dialog field throughout the class.
Hope this helps to someone.
Regards,
/Ashlesh
I faced the problem while using dialog field in my class. I have declared a dialogfield variable for EDT but while assigning the value from the dialog it is not able to keep the assigned value throughout the class where it is being used.
I found some blogs that, by the use of Local Macro (CurrentVersion and CurrentList) you can resolve this issue. But the concept of CurrentVersion is much complicated with it.
Key Point: You have to manually increase the value of CurrentVersion declared as and when you add the dialogfield into the CurrentList macro.
By using above i can able to use the dialog field throughout the class.
Hope this helps to someone.
Regards,
/Ashlesh
Friday, September 17, 2010
Create New Folder(Directory Path) using Morph X
// Verifyes or creates Path
//
static client public boolean createDirectoryPath()
{
int ptr;
FilePath _path = xinfo::directory(directorytype::Bin) + '\Image';
;
_path = strLRTrim(_path);
if (substr(_path,strlen(_path),1) != '\\') // Adding backslash gives a more simple while-loop!
{
_path += '\\';
}
//MKU: enables creation of UNC paths, by detecting which folder already exists (backwards).
ptr = strLen(_path);
ptr = strfind(_path, '\\', ptr, -ptr);
while(!WinAPI::folderExists(substr(_path,1,ptr)))
{
ptr = strfind(_path, '\\', ptr -1 , -ptr);
}
// ptr now points to last existing folder in the path.
//MKU: end
while (ptr)
{
WinAPI::createDirectory(substr(_path, 1, ptr));
if (!WinAPI::folderExists(substr(_path, 1, ptr)))
{
break;
}
ptr = strfind(_path, '\\', ptr + 1, strlen(_path));
}
return WinAPI::folderExists(_path);
}
Hi, it works for UNC path also.
Thanks,
/Ashlesh
//
static client public boolean createDirectoryPath()
{
int ptr;
FilePath _path = xinfo::directory(directorytype::Bin) + '\Image';
;
_path = strLRTrim(_path);
if (substr(_path,strlen(_path),1) != '\\') // Adding backslash gives a more simple while-loop!
{
_path += '\\';
}
//MKU: enables creation of UNC paths, by detecting which folder already exists (backwards).
ptr = strLen(_path);
ptr = strfind(_path, '\\', ptr, -ptr);
while(!WinAPI::folderExists(substr(_path,1,ptr)))
{
ptr = strfind(_path, '\\', ptr -1 , -ptr);
}
// ptr now points to last existing folder in the path.
//MKU: end
while (ptr)
{
WinAPI::createDirectory(substr(_path, 1, ptr));
if (!WinAPI::folderExists(substr(_path, 1, ptr)))
{
break;
}
ptr = strfind(_path, '\\', ptr + 1, strlen(_path));
}
return WinAPI::folderExists(_path);
}
Hi, it works for UNC path also.
Thanks,
/Ashlesh
Thursday, September 16, 2010
Get Axapta Application Different Directory Path
To Access different Axapta Application Directory path:
static void DirectoryPathTest(Args _args)
{
Filepath temppath;
;
temppath = xinfo::directory(directorytype::Bin);
print temppath;
pause;
}
Thanks,
/Ashlesh
static void DirectoryPathTest(Args _args)
{
Filepath temppath;
;
temppath = xinfo::directory(directorytype::Bin);
print temppath;
pause;
}
Thanks,
/Ashlesh
Command parameters to run Axapta Client Application
to import previously exported configuration,
<TT>"...\Ax32.exe" -regimport=C:\MyConfig.xpo</TT>
or
or
to launch Axapta with "MyConfiguration",
<TT>"...\Ax32.exe" -regconfig=MyConfiguration</TT>
OR
OR
combine them both like
<TT>"...Ax32.exe" -regimport=C:\MyConfig.xpo -regconfig=MyConfiguration</TT><BR>to import (overwrite) and launch.
-allowunauth
When using Windows Authentication, this option enables users that do not pass the authentication process to be allowed logging in using user name and password (traditional Axapta logon sequence). If not enabled, users will be rejected if not authenticated.
-aol=<s>
“aol” is an acronym for “Application Object Layer”. Valid layers are: sys, syp, gls, glp, dis, dip, los, lop, bus, bup, var, vap, cus, cup, usr and usp.
-aolcode=<s>
Access code for –aol.
-aos=host:port
Connect to the AOS running at given port number on specified host.
Host is either a DNS hostname (for example server1.damgaard.com) or an IP address (192.88.253.41).
The port number is the number specified for the AOS instance that should be connected to. No instance name needs to be specified because only one instance can be running at a given port on a given machine. Using this option will connect the client directly to the AOS using TCP traffic only and bypass the initial search for the AOS and thereby eliminates the need for networking that supports UDP traffic. This eases firewall configuration and NAT appliances
-aos=instance@host
Connect to the specified AOS instance running at the specified host machine. Instance is the name (for example 'Axapta'), and host is DNS name or IP address of the machine running the AOS. Specifying -aos=MyAOS@MyHost equals setting -servermask=MyAOS and -internet=MyHost (or specifying these in corresponding fields on the server tab in the Configuration Utility).
-aos=ad(<adsn>)
Use Active Directory integration. <adsn> is the "Active Directory Server Name" to search the Active Directory for.
Same as "By name - find a specific AOS" in the Axapta Configuration Utility
-aos=adbrowse
Use Active Directory integration. Search the Active Directory for "Active Directory Server Names" in User objects and Organizations Units. Same as "By organization - browse for per-user or per-organizational specific AOS" in the Axapta Configuration Utility
-aos=ad
Use Active Directory integration - search the Active Directory for any AOS.
Same as "Simple - find any AOS" in the Axapta Configuration Utility
-applexclusive
The application files are opened in exclusive mode.
Note –applexclusive and –applshare cannot both be given.
If you do give both, the one given last on the command line will take effect. You will not get any error messages.
-application=<s>
Specify the name of the Axapta application. Default: Standard
-applshare
The application files are opened in shared mode. This is default.
Note –applexclusive and –applshare cannot both be given.
If you do give both, the one given last on the command line will take effect. You will not get any error messages.
-broadcast= xx.xx.xx.xx
Specify a broadcast address to be used in –CLIENT mode. A request is sent to all the broadcast addresses to obtain identification of the available application servers. The address consists of four decimal values between zero and 255 separated by dots.
-bwsim=<speed>:<latency>
where <speed> states the bandwidth simulated (in bytes per second). The <latency> is specified as a number designating number of ms spent for communication round trip (the fixed overhead (time used) the network applies to sending a package to the server and receive one back). To verify....
-client
Connect to an AOS and run as a three-tier thin client. Use -aos= to specify which AOS.
-client = thin
Connect to an AOS and run as a three-tier thin client. Use -aos= to specify which AOS.
-client = fat
Connect to an AOS and run as a three-tier fat client. Use -aos= to specify which AOS.
-company=<s>
Select initial company <s>. Default: dat
-connectionidletimeout=<seconds>
Set the time in seconds to leave an idle database connection open before closing it. Shorter idle time will decrease database server and Axapta memory usage, but will potentially cause time-consuming re-logins on the fly.
Default: 60 seconds is the default for Microsoft SQL Server, 30 minutes the default for Oracle.
-createdsn=microsoftsqlserver or-createdsn=oracle
Have the data source created automatically in the ODBC manager.
-createdsn_tcpipport=<integer>
TCP/IP port number required for Oracle. This parameter is relevant only when -createdsn=oracle is given. The parameter is ignored if given with -createdsn=microsoftsqlserver.
-database=<s>
Use database <s> when connecting to the database server. Default: The default option is to use the database set in the ODBC driver.
-dbcli= [ODBC]|[OCI]
Runs Axapta in either ODBC or OCI mode. -DBCLI=ODBC is the default.
-dbserver=<s>
Use server <s> during login. Default: The default option is to use the server set in the ODBC driver.
-dbunicodeenabled=0 | 1 Initialize database for Unicode
-directory=<s>
Specify the Axapta root-directory.
-doclanguage=<s>
Use this option if you would like to have the documentation in a different language than the one used in menus and dialogs.
Example:
-doclanguage=da
will give you the documentation in Danish.
Default: The default is that the documentation language is identical to the language used in the system.
This is set by the -language option.
-dsn=<s>
Use ODBC driver data source <s>.Default: BMSDSN
-featurekeysystem
The 3.0 security system is ON by default.Use this parameter to enable the old featurekey system.
-fetchahead=<n>
A maximum of <n> records retrieved from the database at a time. Default: 100
-hint=<n>
Apply database dependent SQL hint(s). Default: Empty for default settings.
-internal=relaxedsyntax The 3.0 kernel defaults to strict X++ syntax checking. For relaxed syntax checking, use this parameter to ease restrictions.
-internet=<s>
Specify an Internet address to be used in –client mode. A request is sent to all the Internet addresses to obtain identification of the available Object servers.
-job=<s>
Run external job <s> prior to any other database-related action during startup. Default: The default is not to run a job.
-language=<s>
Select language <s> for the user interface. Default: Language must be selected during setup.
-log=<s>
Name the SQL error log file (may include a full drive and path specification). Default: trcAxaptaError.log in the standard Axapta log-directory.
-logdir=<s>
Use an alternative directory for the log files generated when you compile, import or export in Axapta. Default: The default is that the log files are generated in the Log folder.
-noauto
Use this parameter to bypass system related application calls made by the Axapta kernel. This includes the ability to bypass startup code, and some timer based calls. This parameter will allow you to startup Axapta in order to fix problems that were introduced in the application code. Normally these problems would prevent you from starting Axapta. For example, if code is introduced in the startup method that causes Axapta to go into infinite loop, and therefore, never finishes the startup procedure, . To change this, start with the –NOAUTO switch, correct the code and restart without the –NOAUTO to have the startup code included again.
-opencursors=<n>
A maximum of <n> database cursors are kept open per connection for cursor reuse. Default: 90 cursors
-port=<integer>
TCP port for the AOS
-preloadthresholdmsec=<milliseconds>
Time used for preloading. For example, -preloadthresholdmsec=3000 results in the issue of a warning whenever preloading exceeds 3000 milliseconds. This value can not be specified per user in Tools, Options, SQL, Warnings. This threshold is only activated when warnings are enabled.
-preloadthresholdrecords=<records> Number of records preloaded. For example, -preloadthresholdrecords=300 results in the issue of a warning whenever preloading exceeds 300 records. This value can not be specified per user in Tools, Options, SQL, Warnings. This threshold is only activated when warnings are enabled.
-querytimelimit =[table:]<milliseconds>
Save queries running longer than a given number of milliseconds to file. If the value of QuerytimeLimit is zero (0), which is the default, no queries are logged. This parameter supports directing output to a table, i.e. SysTraceTable (default is disk-file). Use -QuerytimeLimit=ms for tracing all SQL statements exceeding the ms milliseconds threshold and -QuerytimeLimit=table:ms to do the same to table.
-regconfig=<name>
-preloadthresholdrecords=<records> Number of records preloaded. For example, -preloadthresholdrecords=300 results in the issue of a warning whenever preloading exceeds 300 records. This value can not be specified per user in Tools, Options, SQL, Warnings. This threshold is only activated when warnings are enabled.
-querytimelimit =[table:]<milliseconds>
Save queries running longer than a given number of milliseconds to file. If the value of QuerytimeLimit is zero (0), which is the default, no queries are logged. This parameter supports directing output to a table, i.e. SysTraceTable (default is disk-file). Use -QuerytimeLimit=ms for tracing all SQL statements exceeding the ms milliseconds threshold and -QuerytimeLimit=table:ms to do the same to table.
-regconfig=<name>
Use a Registry configuration called <name>.
A configuration can be created using the Axapta Configuration Utility.
-regimport=<file name>
Import a configuration to the Registry.
The import is performed prior to the evaluation of any other options. This means that you can import a configuration using –regimport and then select it using –regconfig.
-repair
Any non-zero value will force a re-synchronization of SQL system tables during startup. The use of this command-line parameter is logged in the Event log.
Use this option to handle situations when problems in SQL system tables prevent Axapta from starting, for example missing indexes.
-retry=<n>
Delay in seconds before re-executing after a deadlock.
Default: 5 seconds
-securityprovider=<s>
Selects the security provider to use with Windows Authentication and is only relevant for Object Server configuration.
For AOS running on Windows NT the only valid option is "NTLM" which provides authentication based on the NTLM security provider.
For Windows 2000 systems 'Kerberos' is also a valid security provider.
For Windows 2000 networks with solely Windows 2000 servers and clients 'Negotiate' is also an option. This will elect the best suitable security provider automatically.
-serveridletimeout=<seconds>
Specifies how long (in seconds) the AOS instance should be allowed to be running without servicing clients.
When this timeout expires without having clients connected, the instance will be shut down automatically.
This option is well suited to be combined with setting instance startup mode to OnDemand making the server auto-start upon request from client and shutdown when no clients need service for at given amount of time.
-servermask=<s>
Specify the mask <s> for selecting a subset of object servers when running in CLIENT mode. if this option is not specified, and multiple object servers are found, all available object servers will be presented in a selection box.
-share
Share label and identifier files between several applications. if not specified, the files will not be shared.
-singleuser
Run the program in single user mode.
-sqlbuffer=<n>
Set the upper limit in Kbytes of the fixed internal data retrieval buffer.
Default: 24 Kbytes
-sqlcomplexliterals=<n>
About literals and placeholders.
Setting sqlcomplexliterals to the value 1 enables this feature, the value 0 disables this feature.
-sqlformliterals=<n>
About literals and placeholders.
Setting sqlformliterals to the value 1 enables this feature, the value 0 disables this feature.
-sqloraclefirstrowsfix=<n>
Oracle Versions 8.05, 8.06 and 8.15 occasionally selects a poor query plan for queries using the Axapta keyword firstFast row. The symptom is that an index matching the order by specification is preferred, even though another index much better serves the where part and the number of rows returned is small.
Axapta includes a workaround for this problem, which you should only enable if you have verified that the above problem is the cause for poor performance. The Axapta Query Analyzer can be used for detecting this.
A value of 1 enables this work around, a value of 0 disables this feature.
-sqlparm=<s>
Add additional parameters <s> upon database login. The format follows the ODBC standard: “key1=value1;key2=value2”.
An example:
“DIR=c:\db;ID=9”.
Default: The default is no additional parameters.
-sqlpwd=<s>
Use password <s> upon login to the SQL database. Default: bmssa_pwd
-sqltrace[=Table]
Invoke SQL statement tracing to log file or table. Use -sqltrace for tracing all generated SQL statements to file and -sqltrace=table to do the same to table. Default: No tracing.
-sqluser=<s>
Use user name <s> during login to the SQL database. Default: bmssa
-startupmsg=<s>
Text to be displayed during Axapta startup.
-startupcmd=MyCommand
A string that is passed to Axapta and can be used to have your own startup commands executed. The string is passed in the calls
appl.startup(MyCommand)
info.startup(MyCommand)
“appl” and “info” are instantiated objects of the application classes Application and Info respectively. The application classes are inherited from the system classes xApplication and xInfo.
Learn more in the Developer’s Guide. You can access the guide from Axapta’s Help menu.
-useis
Use integrated security during SQL database login and thus disabling values set by using parameters –sqluser and –sqlpwd.
-user=<s>
Log on as user <s>.
-useserverprinters
Have the client direct all printing to the printer connected to the server.
-warnings[=table]
Enable various run-time warnings which are logged to a file, or table. Use -warnings to trace all developer warnings to file and -warnings=table to trace all warnings to a table. Default: No warnings.
-windowsauth={0|1}
This option disables/enables Windows Authentication which, when enabled, is providing Single Sign-On and Authentication of client machine account and the user logging in.
Thursday, August 19, 2010
Change form color company wise
Hi,
I found a beautiful thing while searching for AX dev. from http://discoverax.blogspot.com/2007/12/color-code-your-dynamics-environments.html
following code explain that how to set form's color company wise.
public void run()
{
;
super();
// Set the color scheme of this instance of te SysFormRUn to RGB
this.design().colorScheme(FormColorScheme::RGB);
// Switch and based on the current company change colors, or not for default
switch (curext())
{
case 'DEM':
this.design().backgroundColor(WinAPI::navisionColorRed());
break;
case 'dat':
this.design().backgroundColor(WinAPI::navisionColorBeige());
break;
default:
break;
}
}
Some points:
1. Here curext() will return the current extension for the current company.
2. To get current company name, SRSVSToolsSupport::getFullCompanyName(curext())
3. You can also use appl.company.ext() to get the current extension but will makes a call to server tier which is not effective in some cases.
Thanks,
Ashlesh
I found a beautiful thing while searching for AX dev. from http://discoverax.blogspot.com/2007/12/color-code-your-dynamics-environments.html
following code explain that how to set form's color company wise.
public void run()
{
;
super();
// Set the color scheme of this instance of te SysFormRUn to RGB
this.design().colorScheme(FormColorScheme::RGB);
// Switch and based on the current company change colors, or not for default
switch (curext())
{
case 'DEM':
this.design().backgroundColor(WinAPI::navisionColorRed());
break;
case 'dat':
this.design().backgroundColor(WinAPI::navisionColorBeige());
break;
default:
break;
}
}
Some points:
1. Here curext() will return the current extension for the current company.
2. To get current company name, SRSVSToolsSupport::getFullCompanyName(curext())
3. You can also use appl.company.ext() to get the current extension but will makes a call to server tier which is not effective in some cases.
Thanks,
Ashlesh
Monday, August 16, 2010
How to declare and initialize a Global Object
If you wanted to declare your own global variable object throughout AX application development, below code might be helpful to you.
[your COM DLL Class Name] = WMInterface (this is for my reference)
[your COM DLL Class Init()] = Init() (this is for my reference)
WMInterface WMI;
SysGlobalCache gch = appl.globalCache();
;
WMI = new WMInterface()
WMI.Init();
gch.set(classstr(WMInterface), "WMKey", WMI);
In above line "WMKey" is the unique key to store the unique entry for (Key, Value) pair and WMI is the value for this unique entry.
Thats all.
Now when you want to reuse this object declare, follow steps:
[your desired COM DLL Class method name] = OpenNewItem(int value) (this is for my reference)
WMInterface wmi;
SysGlobalCache gc = appl.globalCache();
;
wmi = gc.get(classstr(WMInterface),"WMKey",null);
wmi.OpenNewItem(1);
Hope it helps someone.
Thanks,
Ashlesh
[your COM DLL Class Name] = WMInterface (this is for my reference)
[your COM DLL Class Init()] = Init() (this is for my reference)
WMInterface WMI;
SysGlobalCache gch = appl.globalCache();
;
WMI = new WMInterface()
WMI.Init();
gch.set(classstr(WMInterface), "WMKey", WMI);
In above line "WMKey" is the unique key to store the unique entry for (Key, Value) pair and WMI is the value for this unique entry.
Thats all.
Now when you want to reuse this object declare, follow steps:
[your desired COM DLL Class method name] = OpenNewItem(int value) (this is for my reference)
WMInterface wmi;
SysGlobalCache gc = appl.globalCache();
;
wmi = gc.get(classstr(WMInterface),"WMKey",null);
wmi.OpenNewItem(1);
Hope it helps someone.
Thanks,
Ashlesh
Tuesday, August 10, 2010
Use Axapta CCADO classes to interact with other databases
Hi,
As per my point of view to access the database outside of AX DB using the CCADO classes method is more effective than using the LoginProperty class.
Below is the use of CCADO classes:
Basically there are 3 main classes:
1. CCADOConnection
2. CCADORecordSet
3. CCADOCommand
Below is the source code template to use the CCADO classes in AX:
X++:
static void Tutorial_CCADO (Args _args)
{
CCADOConnection Connection; CCADOConnection Connection;
SQL str;
CCADORecordSet RSet;
CCADOCommand ADOCom;
;
CCADOConnection = new Connection ();
Connection. ConnectionString (StrFmt ("Provider = SQLOLEDB.1; Persist Security Info = False; User ID =% 3;Password =% 4; Initial Catalog =% 2; Data Source =% 1, '192 .162.0.100','TestBBDD','Sa','sa'));
//Open the connection
Connection.Open ();
CCADORecordSet Rset = new ();
// The decision to execute
SQL = 'Select * from CustTable';
// Execute the query using the previously opened connection
RSET.Open(SQL, Connection);
// Loop while there are records
While(!RSET.EOF())
(
// Display the field AccountNum
info(RSet.fields().itemName('Accountnum').value());
// Next Record
RSet.moveNext();
)
// Now ADOCommand
ADOCom = new CCADOCommand();
// Open connection I associate
ADOCom.activeConnection(Connection);
// Prepare a SQL data modification
SQL = "delete CustTable where AccountNum = '%1'";
// Execute the sentence - in theory delete the record 'cli0001'
ADOCom.commandText(StrFmt( SQL, 'cli0001'));
ADOCom.Execute();
}
Thanks,
Ashlesh
As per my point of view to access the database outside of AX DB using the CCADO classes method is more effective than using the LoginProperty class.
Below is the use of CCADO classes:
Basically there are 3 main classes:
1. CCADOConnection
2. CCADORecordSet
3. CCADOCommand
Below is the source code template to use the CCADO classes in AX:
X++:
static void Tutorial_CCADO (Args _args)
{
CCADOConnection Connection; CCADOConnection Connection;
SQL str;
CCADORecordSet RSet;
CCADOCommand ADOCom;
;
CCADOConnection = new Connection ();
Connection. ConnectionString (StrFmt ("Provider = SQLOLEDB.1; Persist Security Info = False; User ID =% 3;Password =% 4; Initial Catalog =% 2; Data Source =% 1, '192 .162.0.100','TestBBDD','Sa','sa'));
//Open the connection
Connection.Open ();
CCADORecordSet Rset = new ();
// The decision to execute
SQL = 'Select * from CustTable';
// Execute the query using the previously opened connection
RSET.Open(SQL, Connection);
// Loop while there are records
While(!RSET.EOF())
(
// Display the field AccountNum
info(RSet.fields().itemName('Accountnum').value());
// Next Record
RSet.moveNext();
)
// Now ADOCommand
ADOCom = new CCADOCommand();
// Open connection I associate
ADOCom.activeConnection(Connection);
// Prepare a SQL data modification
SQL = "delete CustTable where AccountNum = '%1'";
// Execute the sentence - in theory delete the record 'cli0001'
ADOCom.commandText(StrFmt( SQL, 'cli0001'));
ADOCom.Execute();
}
Thanks,
Ashlesh
Subscribe to:
Posts (Atom)