Показаны сообщения с ярлыком ax2012. Показать все сообщения
Показаны сообщения с ярлыком ax2012. Показать все сообщения

среда, 11 октября 2023 г.

Dynamics 365F&O different types of functions and classess

Just like a small reminder for those who might be forgetting it from time to time. Me personally find this piece of information pretty useful as a remark :-)

Functions:

Static Functions: These functions are tied to the class rather than an instance. They can be called without creating an instance of the class. They're commonly used for utility functions that don't rely on instance-specific data.

Instance Functions: These functions require an instance of the class to be invoked. They operate on the data that belongs to the object and are responsible for object-specific behavior.

Main Method: This is the entry point for class execution, usually for testing or batch processing. The main() method is static and can accept command-line arguments.

Final Functions: These are functions that cannot be overridden in derived classes. This ensures that the implementation of the function remains consistent.

Abstract Functions: These functions don't have any implementation in the base class. Derived classes must provide an implementation for these functions, making them ideal for defining a common interface.

Classes:
Table Classes: These classes directly represent tables in the AOT (Application Object Tree). They're automatically created and can be extended but not modified.

Form Classes: These are auto-generated when you create a form in the AOT. They contain methods that run form logic and control form events.

Data Provider Classes: Used primarily for SSRS reports, these classes gather the data that is then displayed on the report.

Framework Classes: These classes provide foundational structures for common functionalities. Classes like RunBase and RunBaseBatch are examples that provide a standardized way to create batch jobs or runnable classes.

Helper Classes: These are custom-defined classes that encapsulate shared logic or functionalities that can be reused across modules.

Controller Classes: These classes act as mediators in complex operations like reporting or batch processing, organizing the overall execution flow.

Contract Classes: These are used to encapsulate parameters for services or reports, making it easier to manage and validate the input.

Extension Classes: These allow you to add new methods to existing table, form, or class objects without altering the original codebase.

Attribute Classes: These are special classes that act as metadata, allowing you to tag elements in the code for additional behaviors or properties.

Map Classes: These simulate tables but don't involve data storage in the database. They're useful for temporary data manipulation tasks.


Special Classes:
Global Class: This class contains global methods and variables that can be accessed across the application, serving as a utility hub.

Application Classes: Classes like Info, ClassFactory, and Global that serve specific application-level functionalities.

Sys Classes: These are system-level classes such as SysDictTable, SysQuery, and SysFormRun. They are crucial for interacting with system-level functionalities and metadata.

вторник, 20 ноября 2018 г.

How to decode XML string Ax 2012

Hi again! I haven't written posts recently. But today I had a task, which was unusual for me - decode XML string to readable view to parse particular value. Or decoding the XML string.
So, I got a xml node like this

<column columnName="OrderLineFieldValues">&lt;OrderLineFieldValueCollection&gt;&lt;OrderLineFieldValue&gt;&lt;OrderLineFieldSystemName&gt;Backordered&lt;/OrderLineFieldSystemName&gt;&lt;Value&gt;4&lt;/Value&gt;&lt;/OrderLineFieldValue&gt;&lt;OrderLineFieldValue&gt;&lt;OrderLineFieldSystemName&gt;CutInspect&lt;/OrderLineFieldSystemName&gt;&lt;Value&gt;&lt;/Value&gt;&lt;/OrderLineFieldValue&gt;&lt;OrderLineFieldValue&gt;&lt;OrderLineFieldSystemName&gt;Mileage&lt;/OrderLineFieldSystemName&gt;&lt;Value&gt;&lt;/Value&gt;&lt;/OrderLineFieldValue&gt;&lt;OrderLineFieldValue&gt;&lt;OrderLineFieldSystemName&gt;Notes&lt;/OrderLineFieldSystemName&gt;&lt;Value&gt;&lt;/Value&gt;&lt;/OrderLineFieldValue&gt;&lt;OrderLineFieldValue&gt;&lt;OrderLineFieldSystemName&gt;SerialNumber&lt;/OrderLineFieldSystemName&gt;&lt;Value&gt;&lt;/Value&gt;&lt;/OrderLineFieldValue&gt;&lt;/OrderLineFieldValueCollection&gt;</column>';

So, looks a little bit confused, doesn't it?

Well, from this mess I'd need to get particular values. How can I do this?  First of all, I started searching some sort of open API to do this but faced with lack of it. But after 1 hour or so I finally found the desired solution. For me it looks like this:
static void Job3(Args _args)
{
    str output;
    str input = @'my encoded XML string';
 
    output = System.Web.HttpUtility::HtmlDecode(input);
 
    info(output);
}

All that I need is in one HtmlDecode method! It's nice. Now I can continue working on the parser which could help me to get the required value from the XML node.

Hope, this piece of code would be useful for someone other as it was for me!

Happy DAXing! 

среда, 5 сентября 2018 г.

Get LogisticsLocation record from customer

Hi! 
Today I've had a requirement to show some custom fields from the LogisticsLocation record from the customer table. I wrote a display method for a particular field, but this approach can be used in different ways. It depends on your requirements.
So, below the code:

public display IsReservedAccount displayIsReservedAccount(CustTable _customer)
{
    DirParty                        dirParty;
    LogisticsLocation               location;
    LogisticsPostalAddress          address;
    dirParty = DirParty::constructFromCommon(_customer);
    address = dirParty.getPrimaryPostalAddressLocation().getPostalAddress();
    location = LogisticsLocation::find(address.Location);
    return location.IsReservedAccount;
}
Hope it will be useful for someone as for myself. 

пятница, 29 мая 2015 г.

How to insert record in the end of the grid

Hello everyone!
I want to share with you some useful information.
I need to insert new records in the end of the grid. The DAX standatd behaviour's don't let this.
So I have found solution, how to do this.
Here's code, you just need to override create method on needed datasource:

public void create(boolean _append = true)
{
    this.last();
    super(_append);
}

The mose important in this code -  _append property.
By default it has false value, but we need to change it on "true"  otherwise our code won't work.

Please, if you have any questions - comment or send me e-mail!
Thanks!