Tuesday, 20 March 2018

Multi-Line TextEdit control

Hi Everyone,

In case you need to store rather big text you may need to use multi-line text edits. Here I would like to share with you example based on Address Line on Customer Form.

Multi line just a property of the text edit so if you just change mode of control in Customization browser you will be able to use enter in control already.
As soon as you publish customization control will add cut angle what you can use to control its size with mouse:
If you also set height property of control for example to “100px” size will be extended in UI by default:
Important to note that if changing of control mode does not remove filed length restrictions, so you also need to make sure that DAC and DB field has enough allowed length to accommodate all lines.

Have a nice development!

Friday, 16 March 2018

Extend Address Line length

Hi Everyone,

Extending of field length in Acumatica is not a trivial task, so here I want to publish guidance on how I usually do that.

To extend field we need to do 2 things:
  • Extend allowed length in DAC attribute
  • Extend length of Database Column
Welcome under the cut for more details

Tuesday, 13 March 2018

Another process has added/updated/deleted the '{0}' record. Your changes will be lost.

Hi There,

Today want to discuss with you how what is ” Another process has added/updated/deleted” error and how to investigate/fix it.

Why it happens?
Let’s start with error understanding. Actually, this error comes from potential differences between user copy of data and actuals in database.
Before I jump into details I want to remind you few architectural points about Acumatica:
  • Acumatica commits records one by one in most cases. For several records update statement will be executed multiple times.
  • Also Acumatica stores the data needed to be save inside in-memory user specific cache. So it is possible that 2 users may have several versions of the same record with different values that is not yet saved.
  • Saving is always done in transaction.
Back to our exception - there are 2 possible reasons for this error:
  • Record was not found in database during search by keys
  • Record was modified and has changed timestamp

Monday, 12 March 2018

PXProjection – SQL Views using BQL

Hi Everyone,

Occasionally I get question from partners related:
  • Can we Join several tables with possibility to update them all? You know that Joined tables in Acumatica are read-only and you cannot update fields there
  • Can we create/use SQL-like views in Acumatica?
  • How can I join grouped (statistical) view to the DAC?
The answer to all these questions is yes you can do it. But answer on how to do that is not so simple. Obviously the most strait forward way is to create an SQL view and generate a DAC based on it. But this way does not solve point number 1 – SQL view is read-only and does not allow to update tables inside.

The more advanced way is to use Acumatica Framework. Basically, you need to use special PXProjection attribute. PXProjection is some sort of the SQL-like view that is done with BQL with some advanced functionality.

Data Selection though Projection.
To use it you need to complete few steps:
  • Create new DAC that will represent view. This DAC may have less columns than you have in DACs you will select later. So just define fields you need. In the end it will help a bit with select performance.
  • You need to define PXProjectionAttribute on this DAC. For PXProjection constructor you should provide BQL command that will define what tables you want to select. You may use all possible commands of BQL (Join, Where, GroupBy, OrderBy).
public class ARHistoryByPeriod : PX.Data.IBqlTable { … }
  • You need to specify BQLField property for all database related fields. BQLField is inherited from PXDBFieldAttribute, so all DB field attributes (PXDBString, PXDBBool, PXDBInt and so on) have it inside plus most of Aggregate attributes (CustomerAttribute, Account, FinPeriodID). BQL Field is needed to identify from what table (out of joined in BQL above) this particular field should be taken. This configuration cannot be automatic as different tables may have fields with same names. Also do not forget to define correct keys inside your projection DAC.
[FinPeriodID(IsKey = true, BqlField = typeof(FinPeriod.finPeriodID))]
public virtual String FinPeriodID { … }

That is all! Now you can use this DAC inside PXSelects, Reports and Generic Inquires.


You can read more about PXProjection Attribute in Acumatica Help Files.

Data Modification though Projection. Another important thing that is supported by PXProjection is saving changes direct to database. As you have defined DACs in your projection definition, Acumatica knows keys of each record (from original DAC) and can use it to track changes and update values back to correct record of database. But please note that this feature is not available for projections with Group By clause as than keys will be lost with aggregation.

To activate it just put Persistent = true inside PXProjection constructor.

        Where<TaxTran.module,Equal<BatchModule.moduleAP>>>), Persistent = true)]
public partial class APTaxTran : TaxTran { … }

One more example of good editable projection usage:

Persistent = true)]
public class ARCashSale : ARRegister { .. }

Have a nice development!

Monday, 5 March 2018

Keep Multiple Acumatica Installers Locally

Hi Everyone,

When you install Acumatica from AcumaticaERPInstall.msi you actually get program that we call Acumatica Configuration Wizard. Than you can use Wizard to install as many as you wish Acumatica Instances. So Acumatica installation is done thought 2 steps:
  1. Configuration Wizard installation via MSI file
  2. Acumatica ERP Instance deployment via Acumatica Configuration Wizard.
Today want to share with you nice trick on how to have multiple Acumatica Configuration Wizards at the same time.

You most probably know that you cannot install several versions of Acumatica Configurations Wizards on machine at the same time. That is some sort of limitation from Microsoft Windows that does not allow to have one application installed multiple times. However Acumatica instances are there untouched with the version you installed until you have updated it with wizard explicitly.
So if you have Acumatica 2017 on your machine and you want to test Acumatica 2018 than you have to download new installer (AcumaticaERPInstall.msi) and update/replace old version with new one. When you do this you suddenly understand that you cannot install/maintain Acumatica instance of previous version as wizard can only update it.

So how to overcome it? There are 2 ways to do this:

Uninstall new version of Acumatica configuration wizard and install old one. As I have mentioned already this is totally save operation. Uninstallation of wizard will not touch any instances or databases that you can easily use even without wizard. To speed up this you even can write a batch script that can do this in unattended mode but it is still slow and not really nice.

Copy Wizard to Separate Folder and use it from copy any time. Acumatica Configuration Wizard is actually standalone and portable program that can be used without installation. Installation is really need to make it easier for end users. But if you are power user and you know how to use it you can use that nice hidden feature of wizard.

There are few folders that you need to be accessible for Installer:

  • Data - Main folder where Acumatica Configuration Wizard executable are
  • Database - All database related scripts are here.
  • Files - the original copy of Acuamtica instance. During installation wizard copies it to the instance folder
  • Portal - is used only during portal installation
That is actually it. If you copy these 4 folders in separate directory you will be able to user wizard even if you uninstall Acumatica or upgrade it to the new version.

Acumatica Configuration Wizard Copy

To Launch Acumatica Configuration wizard you can go to Data folder and click on AcumaticaConfig.exe. It will lunch wizard as usual.
Acumatica Configuration Wizard

Have a nice installation!