Thursday, 30 June 2016

Export notes to excel from the grid

Hi All,

Today want to share with you simple trick. Starting from version 5.2 Acumatica does not export notes to the excel file from the grid by default. This was done for performance optimizations.

So if you go to Journal Transactions and export data, you will see something like this:
export notes to the excel file acumatica

But fortunately it can be easily changed by using Acumatica customization engine.

Just click Customization->Inspect element and then click on the grid, than click customize.
export notes to the excel file Acumatica

Customize button will open additional window where you can specify some configurations for the grid and other elements. We need just one - Export Notes. Set property to "True" and than you can publish customization project.
export notes to the excel file Acumatica

If you check export one again, you will find additional column with notes.
export notes to the excel file Acumatica

Have a fast export!

Wednesday, 8 June 2016

Using PXView in DataView Delegate

Hi Everyone,

Today I want to share with you one way how you can keep your code simpler.

Lets assume you have some big data view declaration - PXSelect<Table, <InnerJoin, .... <AnotherJoin, ... <MoreJoins, .... <Where<, .... <MoreWheres< .... SomeDataView
And something like this for 10-20-30 lines of code. I'm pretty sure that you can understand what do i mean.
simple code Acumatica
And also this select declaration may be inside Acumatica base code and you want to customize it.

Your task is to create a new data view delegate and select the same data with some additional filtering or dynamic calculations. But we cannot just create delegate and call dataview data, as we will have stack-overflow exception.

First idea to resolve it is to just copy the PXSelect statement and put it into your delegate. But this idea is not perfect, becouse:
  • You will store BQL command twice, and if you need to modify it, you have to do it twice
  • If this statement is from Acumatica source code you have a risk that Acumatica will update this command in the future, but your copy will be untouched.
So to resolve this problem we can use PXView declaration inside the data view delegate with reference to the original BQL Statement.

public IEnumerable dataView()
       PXView select = new PXView(this, true, DataView.View.BqlSelect);

       Int32 totalrow = 0;
       Int32 startrow = PXView.StartRow;
List<object> result = select.Select(PXView.Currents, PXView.Parameters,        
       PXView.Searches, PXView.SortColumns, PXView.Descendings, 
       PXView.Filters, ref startrow, PXView.MaximumRows, ref totalrow);
       PXView.StartRow = 0;

       foreach (PXResult<Contract, ContractBillingSchedule, CSAnswers> row in result)
              //Do any dynamic calculations

       return result;

Some important points here:
  • DataView.View.BqlSelect - using this construction you can get access to the BQL command that lies under the PXSelect<>.
  • Int32 startrow = PXView.StartRow - is required to support proper paging. By default Acumatica will select just some rows that can be shown on user interface. Other rows should be skipped for better performance.
  • PXView.MaximumRows - will be exactly top xx records that will be selected from database.
  • PXView.StartRow = 0; - required to notify base code that you have already filtered data and select required records count. Otherwise base code will trim records one more time, because by default system thinks that you will select all records and return untrimmed list. 
Full code snippet:

Have a nice Development!

Monday, 6 June 2016

Restricting the list of fields selected from database

Hi Everyone

Sometimes you need better control on how Acumatica selects data from database. And here Acumatica Framework provides you some ways to optimize data query.
optimize data query Acumatica
Using PXFieldScope you can specify what fields will be selected form database. This can save some traffic and processors time in large and extra-large statements. Also it can improve performance in case you have plenty of data, but use very few fields from the selected tables. And of course excluding of some complex sub-selects may significantly improve data selecting on SQL servers side.

No RowSelecting events (e.g. from attributes) will be fired for the fields not fed into the FXFieldScope constructor.
Note, that for the head table all key fields should be included into the field scope declaration. 

For example ARStatement and ARStatementCycle tables both include a lot of decimal and string fields (like statement totals for various ages, aging bucket labels, etc.) Still, under some circumstances these field may be not needed to perform an operation on statements. If there is substantial amount of statements in the system, restricting the selected fields may boost performance significantly.

PXSelectBase<ARStatement> select = new PXSelectJoin<ARStatement,
    LeftJoin<ARStatementCycle, On<ARStatementCycle.statementCycleId,
    LeftJoin<Customer, On<Customer.bAccountID,   

using (new PXFieldScope(select.View,
    PXResultset<ARStatement> res = select.Select();

Big thanks to Acumatica Development team for this example.
Have a nice development!

Thursday, 2 June 2016

Mobile Acumatica on Desktop

Hi All,

Today I want to share with you one way how you can play around or even show through the online demo Acumatica mobile application on your laptop/desktop computer.
Actually there are a lot of ways how you can mirror the real device screen, but today I want to go with you with setting up an android emulator on your desktop.
android emulator on desktop

Here you can find step by step instruction of how to setup working instance:
  1. First of all you need to download emulator software to your machine from the official web site. I recommend you to use Andy Android Emulator
  2. Click download and save the file. (installation file will be about 420 MB) 
    Andy Android Emulator
  3. Install Andy android emulator. The installation process is quite strain-forward.
    Andy Android Emulator
  4. Run emulator from Start Menu>Andy>Start Andy
  5. In emulator enter google play (you may need to provide own Google account to access Google Play Market) 
  6. Download and Install Acumatica mobile app to your emulator.
    Andy Android Emulator
More info under the cut ->