Temporary property replaced with TempType property on Tables in Dynamics AX 2012

Friends,

Just for your information: Temporary property in Dynamics AX 6.0 has been replaced with tempType property and we can select from 3 categories. Naming convention of table still remains the same : Tmp prefix followed by your tableName.


1) Regular – means permanent Tables
2) InMemory – same as Temporary table concept in 5.0 , data getting saved to either client or server in the file system . An InMemory table is held in memory until its size reaches 128 KB. The dataset is then written to a disk file on the server tier. The disk file for an InMemory table has the naming convention $tmp.$$$.

Note: we cannot join this table with regular table while querying.
3) TempDB : Only processes that run on the server tier can instantiate TempDB tables.

[Below is the Online developer help]
All types of temporary tables are automatically dropped by the system when the table variable in X++ goes out of scope. A TempDB table is not dropped when you set its record buffer variable to null
Note: we can join TempDB table to a regular table to perform multi-row operations in a single call.

Life span:

A TempDB table is instantiated in the underlying database management system when the first SQL operation is sent to the database system from the AOS. The SQL operation can be either select, insert, update, or delete.

The following table describes the situations that cause a TempDB table to be dropped

1. Variable goes out of scope.
2. Restart of the AOS.
3. Restart of the database system.
4. Closure of the AX32.exe client.
5. Online Users form. [The Online Users form can be used to end any Microsoft Dynamics AX session that is associated with TempDB tables that have not been dropped automatically]

 

Happy Dax 6ng,

Sreenath

On dialogs – SysLookupMultiSelectCtrl in Dynamics AX 2012

This post is in continuation of my old post which helped to use SysLookUpMultiSelectCtrl class on Forms.
The below class will help you to implement the same in the dialogs [Used Runbase framework]. Please note I have used the same query [CustTableLookUp] which I used in my last post.

Please follow the class and its methods as shown below.

public class SR_LookupMultiSelectDialog extends RunBase
{
DialogRunbase dialog;
DialogGroup dialogGrp;

FormBuildStringControl fbsCtrlMultiSelect1;
FormStringControl fsCtrlMultiSelect1;

container returnIds1;

SysLookupMultiSelectCtrl msCtrl1;
}
__________________________________________________
public ClassDescription caption()
{
return ‘Multiple select lookup on dialog’;
}
__________________________________________________
// Generate dialog
public Object dialog()
{
FormBuildControl setupGroupControl;

dialog = super();

dialog.alwaysOnTop(true);
dialog.windowType(FormWindowType::Standard);
dialogGrp = dialog.addGroup(‘Group’);

setupGroupControl = dialog.formBuildDesign().control(dialogGrp.formBuildGroup().id());

// Control with the MULTI-SELECT
fbsCtrlMultiSelect1 = setupGroupControl.addControl(FormControlType::String, identifierstr(ctrlRoles1));
fbsCtrlMultiSelect1.label(‘Select multiple customers’);

dialog.allowUpdateOnSelectCtrl(true);

this.dialogSelectCtrl();

return dialog;

}
__________________________________________________

public void dialogPostRun(DialogRunbase _dialog)
{
FormRun formRun;

super(dialog);

formRun = _dialog.dialogForm().formRun();

if (formRun)
{
fsCtrlMultiSelect1 = formRun.design().control(fbsCtrlMultiSelect1.id());
msCtrl1 = SysLookupMultiSelectCtrl::construct(formRun, fsCtrlMultiSelect1, querystr(CustTableLookUp));

}
}
__________________________________________________

// Get input values
public boolean getFromDialog()
{
#Characters

// Return Ids from the 1st mutli-select control
if (msCtrl1)
returnIds1 = msCtrl1.get();

info(‘Control 1 – ‘ + con2StrUnlimited(returnIds1,#SEMICOLON));

return true;
}
__________________________________________________

static void main(Args _args)
{
SR_LookupMultiSelectDialog SR_LookupMultiSelectDialog = new SR_LookupMultiSelectDialog();

if (SR_LookupMultiSelectDialog.prompt())
{
SR_LookupMultiSelectDialog.run();
}
}
__________________________________________________


Below is the dialog [Screen shot for reference ] which will allow to select multiple values from the lookup

Please refer to Tutorial_LookUpMultiSelectDialog for more detailed example.

Happy Dax 6ng
Sreenath

SysLookupMultiSelectCtrl on Forms in Dynamics AX 6.0 [AX 2012, X++]

Friends,

I was going through some of the new objects/classes which have been introduced in AX 6.0 and found this class SysLookupMultiSelectCtrl helpful, which will serve multi selection in the grid lookup control.

I still remember we had to work around in 5.0 to attain this kind of functionlaity of getting the data from multiple datasources in lookups and adding columns accordingly.

Well in 6.0 – It’s very easy to implement using SysLookupMultiSelectCtrl class.

Below are the steps on how to achieve this :

1) Create a new Query by name CustTableLookup in the AOT >> Queries. Add 2 data sources [In the below example : I have added CustTable and CustTrans as datasources and linked these datasources by setting up relations property to Yes in CustTrans datasource]

2) Remove fields which dont want to be queried on or donot want in the lookup columns by setting the dynamic peroperty to No on the fields in the datasource and by deleting unwanted fields to be selected.

Find the screen shot below for reference.

3) Create a new form in the AOT >> Forms and give a meaningful Name – [I have named it as SR_LookupMultiSelectGrid]

Add a simple string control in the design and Name it as CustAccount and set the autodeclaration property to Yes as we are going to use this control in the X++ code within the form. [Refer screen shot below]

Now please write/override the following methods and copy paste the code

In the classDeclaration

public class FormRun extends ObjectRun
{
SysLookupMultiSelectCtrl msCtrl;
}

Override the init() method on the element and instantiate the SysLookupMultiSelectCtrl by passing the element , control in which you want the lookup and the Query to get the lookup data

public void init()
{
super();
msCtrl = SysLookupMultiSelectCtrl::construct(element, CustAccount, querystr(CustTablelookup));
}

Finally override the task() method and copy paste the below logic

public int task(int _taskId)
{
#task
int ret;

ret = super(_taskId);

if (ret && _taskId == #TaskSave)
{
// Call appropriate saving here…
msCtrl.get(); // get the Returned Ids
}

return ret;
}

Thats it. We are done. Now let’s ee how lookup looks like and how to select the mutliple items in the lookup and the selected values are returned in to the String control. Below screen shot for reference, Notice that in the lookup we have got the fields from different tables and data is filtered accordingly and also we have provision of selecting multiple rows in the lookup [check box ] provided and all you need to do is Mark the rows and click on Ok button
href=”https://dynamicsaxgyan.files.wordpress.com/2011/06/multiselect.jpg”>

Finally On clicking the Ok button – all the multi selected values will be set as a text in the string control as shown below.

For more information: Refer tutorial_LookupMultiSelectGrid
Next post will be on >> LookupMultiSelectDialog

Happy Dax 6ng

Sreenath