How to download DAC schema browser

Hello everybody,

here is just short post on how to download DAC Schema browser which I recently opensourced.

You'll need two steps:

1. Navigate in your browser to link https://github.com/YuriyZaletskyy/DacSchemaBrowser 2. Click on Star as displayed on screenshot (this is optional step):

       4. Right mouse click AcumaticaTablesFixed19x100x0122.zip

       5. Save customization wherever you wish

       6. Publish on your local instance

That particular file is intended for Acumatica version 2019 R1 build 0122, but it should work on higher versions as well. Later on I'll add lower versions as well.

How to get list of all Acumatica tables

Hello everybody,

today I want to share single line of code, which I found recently while digging Acumatica source code with reflector. Sometime you may need to know if there is some or antoher Acumatica table available. For example if you create some customization plugin. How to find out if there is some table? You can use following line of code for this purpose:

using PX.Api.Soap.Screen;

............

var acumaticaTables = ServiceManager.Tables;

Variable acumaticaTables will have a list of Acumatica tables.

Configuration Error for Acumatica T100 training

Hello everybody,

once upon a time Acumatica requires for certified developers to pass over certification again. 

As obedient person I decided to install T100 sample application over Acumatica Framework Configuration ( don't mix with Acumatica ERP Configuration ). Then I navigated to just installed application, and here is what I've seen:

Server Error in '/T100a' Application.


Configuration Error

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: The connection string name is missing for the MySqlSiteMapProvider

Source Error:

Line 283:    <siteMap>
Line 284:      <providers>
Line 285:        <add name="MySqlSiteMapProvider" type="MySql.Web.SiteMap.MySqlSiteMapProvider, MySql.Web, Version=8.0.13.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionStringName="LocalMySqlServer" applicationName="/" />
Line 286:      </providers>
Line 287:    </siteMap>

Source File: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config    Line: 285


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.3282.0

 

 

Very puzzling honestly speaking. You've just installed something, and right from the start it doesn't work. 

After some Research I have found, that following some additions should be added to node siteMap section providers:

			<siteMap enabled="true" defaultProvider="PXDatabaseSiteMapProvider">
				<providers>
			            <remove name="MySqlSiteMapProvider" /> <!-- add this line --> 
			            <remove name="PXWikiProvider" />

 

After those additions I was able to open Training sample T100.

How to call action Cancel in Acumatica

Hello everybody,

Today I want to leave a short notice on how to call Cancel button of Acumatica from inside C# code:

graph.Clear();

That is it, Clear method is binded to button Cancel in Acumatica. Besides that Clear method will reload current data record from database and rolls back changes of Cache objects.

PXUIRequired attribute usage in Acumatica

Hello everybody,

today I want to say a bit more about usage of attribute PXUIRequired as previous article on my blog wasn't very easy to follow by some of my readers.

Take a look on presented code sample:

public class sOOrderType : Constant<string>
{
	public const string SOOrderType = "SO";
	public sOOrderType() : base(SOOrderType)
	{	
	}
}
 
public class SOOrderExt : PXCacheExtension<SOOrder>
{
	[PXMergeAttributes(Method = MergeMethod.Append)]
	[PXDefault]
	[PXUIRequired(typeof(Where<SOOrder.orderTypeEqual<sOOrderType>>))]
	public virtual string CustomerOrderNbr { getset; }
}

As you can see, besides attribute PXUIRequired it has declaration of constant value "SO". With that declaration before class you may get validation only for SO Order type "SO".

And now as you see on screenshot, field Customer Order got it's star. Take notice that color of that star is also differnet, it become red.

One more point which I want to underline, attribute PXUIRequired will work in connection with PXDefault attriubute. Without PXDefault attribute you'll get another error message, so as as summary, use PXUIRequired attribute with PXDefault.

One more definition of Group by for T-SQL

Hi everybody,

today I want to give one more definition of Group by of SQL language which for me is very explanatory.

Group by statement produces a record for each unique combination of group by columns list and ommiting other columns of tables.

Also you can apply aggregate functions to other columns. Aggregate functions may be count, sum, avg, mean, max, etc.

And each of the functions will be executed against columns of groupped records.

Logical sequence of T-SQL operations

Hello everybody,

Today I want to note that SQL Server has following order of processing:

  1. From
  2. Where
  3. Group by
  4. Having
  5. Select
  6. [Expressions]
  7. [Distinct]
  8. Order By
  9. [TOP/OFFSET-FETCH]

By looking on this order you may understand why in C# LINQ from goes first and not select. That is because C# is imperative language, while SQL is declarative.

Four classes of databases systems

Hello everybody,

I want to leave a short note on four types of database systems:

  • OLTP
  • DSA
  • DW
  • ETL

Online transactional processing

This type of systems is used for data entry, basically for CRUD operations. As usually some rules of normalization is applied there. Also OLTP is not suitable for reporting purposes because processing normalized data takes a lot of computing powers. That's why next type of systems is used:

Data warehouses

This kind of systems is used for data-retrieval and reporting purposes. Mainly it's structure is optimized for data-retrieval needs. Quite often tables have redundancy, fewer tables, simpler relationship between tables. You can learn a bit more about data warehouses via googling of data warehouse + star schema, data warehouse + facts table,  data warehouse + data mart, etc. 

ETL

The process of pulling data from OLTP is named extract, transform, load. For such purposes often used Microsoft SQL Server Integration Services ( SSIS ) for handling ETL needs.

DSA

Quite often ETL is implemented not as one step, but in stages, of creating separate stages and locating those stages on separate databases. Then those databases belong to Data Staging Area. 

How to extend Persist of your own graph in Acumatica

Hello everybody,

here I want to leave a short line on how to extend Perist method of your own graph.

I described once long time ago how to override Save action in your extension, but sometime it can be needed to override Persist in your own graph.

Sometime it can be necessary. Below goes sample of code for this purpose:

public override void Persist()
{
	//Some other custom business logic
 
	base.Persist();
}

Here you go.

How to compare Acumatica objects without ObjectsEqual

Hello everybody,

Long time ago I made a post on how to extend if needed method  ObjectsEqual in Acumatica.

today I want to extend my answer a bit more and share with you class OneLevelComparer. With help of this class you may check if some object was changed without need of typing all fields of DAC class. Take a look on the class itself:

/// <summary>
/// Comparison of two objects on equality based on reflection. 
/// Doesn't support inner collections, objects.
/// </summary>
public static class OneLevelComparer
{
	// Item1: property name, Item2 current, Item3 original
	public static List<Tuple<stringobjectobject>> Differences<T>(T current, T original)
	{
		var diffs = new List<Tuple<stringobjectobject>>();
 
		MethodInfo areEqualMethod = typeof(OneLevelComparer).GetMethod("AreEqual"BindingFlags.Static | BindingFlags.NonPublic);
 
		foreach (PropertyInfo prop in typeof(T).GetProperties(BindingFlags.Instance | BindingFlags.Public))
		{
			object x = prop.GetValue(current);
			object y = prop.GetValue(original);
			bool areEqual = (bool)areEqualMethod.MakeGenericMethod(prop.PropertyType).Invoke(nullnew object[] { x, y });
 
			if (!areEqual)
			{
				diffs.Add(Tuple.Create(prop.Name, x, y));
			}
		}
 
		return diffs;
	}
 
	private static bool AreEqual<T>(T x, T y)
	{
		return EqualityComparer<T>.Default.Equals(x, y);
	}
}

Then further in the code you may build your conclusions depending of changes for example like this:

var changes = OneLevelComparer.Differences(currentApSetup, apSetupOriginal);
foreach (Tuple<stringobjectobject> change in changes)
{
	if(change.Item1 == "tstamp")
		continue;
	if(change.Item1 == "LastModifiedDateTime")
		continue;

etc...