Enums And Strings


Hello everybody,

I want to share some pieces of code how to work with enums. 

Some time it is needed to have list of string constants in your code, which can feet to some strings with spaces. 

enum EarningType
        [Description("Salt and Lasso")]

One of easy ways to use description is usage of extension methods like this:

 public static class EnumsProcessor
        public static string GetEnumDescription(this Enum value)
            var fi = value.GetType().GetField(value.ToString());

            var attributes =
                (DescriptionAttribute[])fi.GetCustomAttributes(typeof(DescriptionAttribute), false);

            if (attributes.Length > 0)
                return attributes[0].Description;
            return value.ToString();

and then in code you can write something like this:

EarningType.VL.GetEnumDescription() which will return you description from description field.

No Comments

Add a Comment

Pxselect Vs Pxselectreadonly

Hello everybody,

today I want to share with you important difference between PXSelect  and PXSelectReadonly.

In my project I had the following situation. PXSelect of table name didn't give me what actually was in db. After a long research I found PXSelectReadonly and key difference is that PXSelectReadonly reads directly from db without usage of Acumatica Cache. 

No Comments


Add a Comment


Execute Stored Procedure In Acumatica


Hello everybody.

I want to share if you need to execute stored procedure in Acumatica how to achieve it. 

It's simple.

1. Create Stored procedure in db.

2. Use in your code PXDatabase.Execute.

For example let's say you created stored procedure which has name DeletePrTranByPrPayrollAndPayrollDetailsId and takes as parameters @prPayrollRefNbr and @prPayrollDetailsID which are of type nvarchar.

Then you can call stored procedure in the following way:

var pars = new List<PXSPParameter>();

PXSPParameter p1 = new PXSPInParameter("@prPayrollRefNbr", PXDbType.NChar, details.PayrollRefNbr);

PXSPParameter p2 = new PXSPInParameter("@prPayrollDetailsID", PXDbType.NChar, details.PRPayrollDetailID);



PXDatabase.Execute("DeletePrTranByPrPayrollAndPayrollDetailsId", pars.ToArray());


  • Chris H said

    I recommend to include the execute statement inside the PXTransactionScope

  • David Eichner said

    I tried using your example but get errors:
    The type or namespace name 'List' could not be found

    A local variable named 'pars' cannot be declared in this scope because it would give a different meaning to 'pars'

    A local variable named 'p1' cannot be declared in this scope because it would give a different meaning to 'p1'

  • docotor said

    David, you also will need to add following usings:

    using System.Collections;
    using System.Collections.Generic;
    using System.Linq;

    without them List will not be available for you


Add a Comment


Rowpersisting Declaration In Acumatica


Just small search result.

Row persiting event declares as following:

protected virtual void YourDACClasss_RowPersisting(PXCache cache, PXRowPersistingEventArgs e)



No Comments

Add a Comment


Create New Instance Of Graph In Acumatica



today I want to note how to create new instance of Graph. Lets say you need to create instance of graph PRPaySlipManager.

In that case you can get instance of that graph in the following way:

PRPaySlipManager manager = PXGraph.CreateInstance<PRPaySlipManager>();

No Comments


Add a Comment


Filegroup Reference And Partitioning Scheme Is Not Supported In This Version Of Sql Server


Hello everybody,

I want to share how to fight with error:

Filegroup reference and partitioning scheme' is not supported in this version of SQL Server.

Today I wanted to move Acumatica to SQL Azure and faced that error message. After research I found that I have to remove the two "ON [PRIMARY]" parts of the create statement and it will work. I mean creating of db

No Comments


Add a Comment


Rowinserting And Rowinserted Difference In Acumatica


Hello everybody,

now I want to share with you difference between RowInserting and RowInserted events.

The RowInserting event happens before the new data record is actually inserted into the cache but after all field events happen for this data record. The RowInserted event happens after the actual insertion. If you change the data fields of the data record that you insert in a RowInserting event handler, no field events will be raised for these data fields. You use the RowInserted event to do something after a data record is inserted into the cache. For example, you can use a RowInserted event handler of the master data record to add a default detail data record.

Sample of RowInserting:

protected virtual void APAdjust_RowInserting(PXCache sender, PXRowInsertingEventArgs e)




Sample of RowInserted

protected virtual void APAdjust_RowInserted(PXCache sender, PXRowInsertedEventArgs e)




The main purpose of RowInserted IMHO is to add default details to data record

No Comments


Add a Comment


The Structure Of A Strategy Program In Lua


Hi all,

I continue investiaging another area of knowledge of humankind, which is FXCM trading Station.

So, if you need to write strategy, you'll need following methods to be defined in your strategy: 

  1. Init()
  2. Prepare(nameOnly)
  3. Update()
  4. ReleaseInstance()
  5. AsyncOperationFinished(cookie, successful, message, message1, message2)
  6. CheckParameters(parameters)
  7. ChangeParameters()

Now little bit details:

The Init() function of the strategy is called once, when the host application has just loaded the strategy into the memory. In this function the strategy must create profile. Profile is the information which is required for creation of the strategy: strategy name and description and parameters.

When the function is being executed, there is a global variable called strategy. You must use the table kept in this variable to provide all necessary information.

Note: Values of any global variables, which are defined in the Init() function will not be available in the other strategies functions. Because the user can apply multiple instance of the same strategy at the same time, the new instance of the strategy is created every time when the user applies the strategy.

Prepare function is called every time when the user applies the strategy. At this moment, a copy of the strategy code is created. This copy is called strategy instance. At one moment, there can be as many strategy instances as many times the strategy is applied.

In this function you must:

  • Prepare all common data for further work of the strategy logic.

When the function is being executed, there is a global variable called instance. You must use this to access to the instrument and parameters data.

Parameter nameOnly indicates whether this function was called just for creating instance's name.

Important: strategy instance is always created in a new context. The Init() function is not called for an instance, so there is no way to pass data from the Init() function to the Prepare() function.

Update is a most important function in the strategy. The update function is called every time when a new bid or ask price appears on the instrument to which the strategy is attached.

Use the terminal table to get access to the trading application functions.

Release function is optional, you can omit it in your strategy.

In case this function exists, it is called before the strategy instance is destroyed. You can use this function to dispose objects created in the Prepare function.

Other functions will be described in another post

No Comments

Add a Comment


How To Add Buttons Refresh Add Row Delete Row Fit To Screen In Grid Of Acumatica


Hello everybody,

Imagine that you crated in your page Grid, and when opened it at page can't notice buttons Refresh Add Row, Delete Row, Fit To Screen in Grid. I believe it can be puzzling how to add those buttons to screen as it was for me at once.  Add to your grid following line:


For example it can look like this:

<px:PXGrid ID="PXGrid1" runat="server" DataSourceID="ds" TabIndex="-8036" AdjustPageSize="Auto" AllowPaging="True" Height="200px" Width="100%" SkinID="Details" KeepPosition="True" MatrixMode="True"  SyncPosition="True">

If you add those attributes, you'll see those buttons.

No Comments


Add a Comment


What Is Tstamp


Hello everybody,

I want to share what is purpose of field TStamp in database for tables in Acumatica. In reality you can make projects without it, but. If you add it, you'll help Acumatica with concurency management

No Comments


Add a Comment