Import CSV files

As you have seen the Exporting Complete Table Record into CSV in the last post. Same way here i have written Code for Importing CSV into Table

static void Import_CSV(Args _args)
{
common TableBuffer;
DictTable dictTable = new DictTable(tableNum(TableName)); // Define Table Name
str TableName = dictTable.name();
DictField dictField;
int i;
CommaIo file;
container line;
str path = 'C:\\Users\\saadullah\\Documents\\'+TableName+'.csv'; // Directory Path
#define.filename(path)
#File
file = new CommaIo(#filename, #io_read);
if (!file || file.status() != IO_Status::Ok)
 {
 throw error("File cannot be opened.");
 }
TableBuffer = dictTable.makeRecord();
while (file.status() == IO_Status::Ok)
 {
 line = file.read(); // Selecting File values line by line as assigning to Container
 if (line != conNull())
 {
 // Looping the Table Field
 // we have Defined - 15 from the Counting of Fields 
 // we do not Require 15 System Field such as RecId, RecVersion, Created By, Created Datetime, Modified By, etc...
 for( i =1; i <= dictTable.fieldCnt() -15; i++)
 {
 // Selecting the Fields
 dictField = new DictField(dictTable.id(), dictTable.fieldCnt2Id(i));
 // Assigning the Container values to the Selected Table Field
 TableBuffer.(dictField.id()) = conpeek(line, i);
 }
 // Inserting Record 
 TableBuffer.doInsert();
 }
 }
}

Export CSV file

Hi Guys,.

Today i’m going to share one of the easiest way to Export and Import the Data without Microsoft Office Excel.
Its Comma Separated Value (CSV). The main Objective of CSV is storing the table record in the CSV file. even though i have found it from CookBook. But i have modified that coding for General Purpose in any table we can easily Export and Import.
Here i have written my Job for Exporting Complete data of any defined Table into CSV..

static void ExportCSV(Args _args)
 {
 common TableBuffer;
 DictTable dictTable = new DictTable(tableNum(TableName)); // Define Table Name
 str TableName = dictTable.name();
 DictField dictField;
 int i;
 CommaIo file;
 container line;
 str path = 'C:\\Users\\saadullah\\Documents\\'+TableName+'.csv'; // Directory Path
 #define.filename(path)
 #File
file = new CommaIo(#filename, #io_write);
if (!file || file.status() != IO_Status::Ok)
 {
 throw error("File cannot be opened.");
 }
TableBuffer = dictTable.makeRecord();
// Select the Entire Table
 while select TableBuffer
 {
 // Looping the Table Field
 // we have Defined - 15 from the Counting of Fields
 // we do not Require 15 System Field such as RecId, RecVersion, Created By, Created Datetime, Modified By, etc...
 for( i =1; i <= dictTable.fieldCnt() -15; i++)
 {
 // Selecting the Fields
 dictField = new DictField(dictTable.id(), dictTable.fieldCnt2Id(i));
// Adding the Selected Field values in Container
 line += [ TableBuffer.(dictField.id()) ];
}
 // Wrting the Selected Container Expression in File
 file.writeExp(line);
// we have to store the Next Records , so we are making Container to Null
 line = ConNull();
 }
info(strfmt("File Successfully Created in %1", #filename));
}

Enterprise Portal Development

This video is a developer-oriented, deep-dive technical session about Enterprise Portal (EP) for Microsoft Dynamics AX 2009. Developers will learn how to build and customize EP pages and user controls for lists, tasks, and wizards. The video also covers using SilverLight in EP.

LookUp value from Multiple Companies

Hi guys , Its really good to use multiple Company Datas in Lookup.

Here i have designed for this solution..

1.Created one New Tabled called SaadLookpUp. which contains the field of String Data Type which EDT as Name
2. Created one New Form called SaadMultiCompLookUp. here i have used this form for bulding LookUp
added new datasource with the Table of SaadLookpUp and set CrossCompanyAutoQuery to Yes.
More Reference for creating Form_LookuP
3. Created one new EDT called SaadMultiCompLookUp and set FormHelp to SaadMultiCompLookUp

4. Created another Form called SaadOutputMultiComp , in this form i have shown two way of retrieving Names,  one way is showing All Company Names and another way is  showing Names from the selected Company. .
Created one String Control in Design node of this form called Name and set ExtendedDataType as SaadMultiCompLookUp.

Continue reading

Lookup Values From MultiTable

Hi guys,

Today my TL assigned me a task for showing LookUp values from Multi Table.
here is the solution how i achieved.

Im having 2 tables
1> SaadMen which contains Name of Men

MenTable
2> SaadWomen which contains Name of Womens
womenTable

And Final Result i have got like this
Result

For more Reference… Download this XPO

Enjoy 🙂 …

My AX Chat Apps

I have created one simple AX Chat Apps ..

Its really too simple to communicate between AX Users….

the features which i have added in this Apps is Showing the Online , Offline Users, Sending Message to Offline Users, Chat with online users Simultaneously….

Download this XPO