C# Delegates

Delegates in C# hold a reference to a method. If you think about writing methods, you may generally send parameters such as objects/type variables to the method. At times, you may want to send an actual method as a parameter to another method. Delegates are like a placeholder for methods. Let’s go through an example. Let’s say we have a list of customers that are based on different cities. Customer c1 … Continue reading C# Delegates

Generics and T in C#

Generics in the .NET Framwork allow you to work with generic types without having to specify a data type until the class is instantiated. Generics are useful, in that you may have a class that you don’t want to limit the functionality to a certain data type. For example, you may have a class that can compare 2 integers, or it could also compare 2 strings. Instead of creating 2 … Continue reading Generics and T in C#

Collections in C#

The .NET Framework contains different types of collections that can be used to store and retrieve data. In this post we will look at the different types. Collections consist of: Queue Stack ArrayList List LinkedList Dictionary Each collection type has different benefits. Collections in the .NET Framework are in: System.Collections System.Collections.Generic Queue A queue is a FIFO (first in first out) list. You can think of this as like a … Continue reading Collections in C#

Dynamics GP Trial Balance

Dynamics GP has a Trial Balance report you can run. To run the report, go to Reports->Financial->Trial Balance: This will open a window where you will have different options on reports to run: Select Detailed->Demo and Modify and it will open the window below: You have the ability to specify which what to include, the year, sorting etc. I have selected Start and End of Fiscal Year as the date range. Select … Continue reading Dynamics GP Trial Balance

Dynamics 365 Using EntityReference to Get Name from Id

When connecting to Dynamics 365 from code, you can retrieve records of an entity through RetrieveMultiple. When using RetrieveMultiple, you specify the columns you would like to retrieve using a ColumnSet. Either specify the columns like this: ColumnSet columnSet = new ColumnSet(“name”, “opportunityid”, “parentaccountid”); Or retrieve all columns like this: ColumnSet columnSet = new ColumnSet(true); In some cases, the columns retrieved will be an Id. For example, when retrieving Opportunities, … Continue reading Dynamics 365 Using EntityReference to Get Name from Id

C# Interfaces

The purpose of Interfaces in C# is to define a contract. Any class that then implements the interface will know which methods it needs to have. An interface is like an abstract class, but without any implementation. Let’s look at an example. Let’s say we have a Vehicle interface, like below. A Vehicle will have wheels. If this were an abstract class, we could define the implementation of HowManyWheels, for … Continue reading C# Interfaces

Unified Service Desk – Default Action

Most Unified Service Desk controls have a “default” action. This action performs an action called default. In cases where the control does not have a default action, running this action will load the control. For example, let’s say we have a custom hosted control called “Dashboard” of type CRM page. We can run the default action from the debugger: This will open the hosted control:  

Using DAX PREVIOUSYEAR

We can also perform time intelligent functions on our date fields in DAX. Let’s compare this year’s sales to last year’s sales. We will create a new measure for previous year sales. First, let’s create a date table. This is created in Power BI Query Language (M): Next, create the measure. We are calculating the sum of the extended price, in the previous year, using the PREVIOUSYEAR function: What this means, is … Continue reading Using DAX PREVIOUSYEAR

Using DAX Single Date Functions

Some DAX functions will return a single date. Let’s go through some of these with our dataset. STARTOFMONTH If we apply this to our data without a filter, it will find the start of the first month: LASTDATE ENDOFQUARTER Applying this to 2016, it uses the first 2016 record (09/02/2016) and gets the end of that quarter:  

DAX Calculated Columns

Let’s start with a dataset that has sales orders. There are sales order lines: And the data looks like this: However, there is no extended price in this dataset. To calculate it, let’s add a new calculated column. Click on the ellipse on the dataset: And select New column: Add the formula: The new column will appear in the dataset: And the new column can be added to our Power BI … Continue reading DAX Calculated Columns