Hi!
Now I am about to show you how create a CSV file in Ax 2012 R3.
First of all, we need to create an instance of the class CommaTextIo, a Container, and the reference to the #File macro.
01 static void CreateCSV(Args _args)
02 {
03 CommaTextIo file;
04 Container line;
05 InventTable inventTable;
06 #File
07
08 file = new CommaTextIo("c:\\users\\jarizmendi\\aCSVFile.csv", #io_write);
09 if (!file || file.status() != IO_Status::Ok)
10 {
11 throw error("File cannot be opened.");
12 }
13
14 while select * from inventTable
15 {
16 line = [inventTable.ItemId, inventTable.ItemName];
17 file.writeExp(line);
18 }
19 info("It works!!.");
20 }
Then, we need to create the CSV file in a specified directory, and finally, we need to write the data as lines 14 to 18 show.
I hope it helps!!
Tuesday, November 24, 2015
Creating a CSV File from Ax
Labels:
AX2012,
CommaTextIo,
Dynamics Ax 2012 R3,
X++
Friday, November 20, 2015
Updating Inventory Dimensions Group in Ax 2012
Hi!
If you need to change the Inventory Dimension Groups In Ax (StorageDimensionGroup and TrackingDimensionGroup), you could use this.
1 InventTable inventTable;
2 EcoResStorageDimensionGroup ecoResStorageDimensionGroup;
3 EcoResTrackingDimensionGroup ecoResTrackingDimensionGroup;
4 ;
5 inventTable = InventTable::find("anArticle");
6 ecoResStorageDimensionGroup = ecoResStorageDimensionGroup::findByDimensionGroupName("anotherGroup");
7 ecoResTrackingDimensionGroup = ecoResTrackingDimensionGroup::findByDimensionGroupName("anotherGroup");
8
9 InventTableInventoryDimensionGroups::updateDimensionGroupsForItem(
10 curext()
11 , inventTable.ItemId
12 , ecoResStorageDimensionGroup.RecId
13 , ecoResTrackingDimensionGroup.RecId
14 , inventTable.Product);
15 }
Line 1 to 4 declarations, line 5 to 7 finding the ItemId named "AnArticle" and the Storage Dimension Group and the Tracking Dimension Group, they both named "anotherGroup".
Line 9 performs the updateDimensionGroupsForItem of the class InventTableInventoryDimensionGroups.
Important!. There must not be physical movementsor financial movements pending for this item.
If you need to change the Inventory Dimension Groups In Ax (StorageDimensionGroup and TrackingDimensionGroup), you could use this.
1 InventTable inventTable;
2 EcoResStorageDimensionGroup ecoResStorageDimensionGroup;
3 EcoResTrackingDimensionGroup ecoResTrackingDimensionGroup;
4 ;
5 inventTable = InventTable::find("anArticle");
6 ecoResStorageDimensionGroup = ecoResStorageDimensionGroup::findByDimensionGroupName("anotherGroup");
7 ecoResTrackingDimensionGroup = ecoResTrackingDimensionGroup::findByDimensionGroupName("anotherGroup");
8
9 InventTableInventoryDimensionGroups::updateDimensionGroupsForItem(
10 curext()
11 , inventTable.ItemId
12 , ecoResStorageDimensionGroup.RecId
13 , ecoResTrackingDimensionGroup.RecId
14 , inventTable.Product);
15 }
Line 1 to 4 declarations, line 5 to 7 finding the ItemId named "AnArticle" and the Storage Dimension Group and the Tracking Dimension Group, they both named "anotherGroup".
Line 9 performs the updateDimensionGroupsForItem of the class InventTableInventoryDimensionGroups.
Important!. There must not be physical movementsor financial movements pending for this item.
Labels:
Dynamics Ax 2012 R3,
InventTableInventoryDimensionGroups,
Storage,
StorageDimensionGroup,
Tracking.,
TrackingDimensionGroup,
X++
Subscribe to:
Comments (Atom)