Archives

Archives / 2014 / July
  • Create new instance of graph in Acumatica

    Hello,

    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>(); more

  • 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 more

  • 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 more

  • 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: … more

  • 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:

     SkinID="Details"

    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. more

  • 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: 

    Init()

    Prepare(nameOnly)

    Update()

    ReleaseInstance()

    AsyncOperationFinished(cookie, successful, message, message1, message2)

    CheckParameters(parameters)

    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 … more

  • CompanyID may not be empty

    Hello everybody.

    In case if you want to add some table to Acumatica with compnayid field, and suddenly you can't save it, check weather you configured default Value or Binding in db. It should be ((0)) like on the screenshot:

    I noticed it only recently while coping with error message about company id more

  • PXDefault PXParent in Acumatica

    Hello everybody,

    today just quick fact. In master-detail DAC and Graph there are used attributes PXDBDefault and PXParent. For me it was interesting to know, that PXDBDefault is intended for initializing values and PXParent is intended for cascade deleting of rows. more

  • Acumatica epic failed or captions at page not appear

    Hello everybody.

    I want to share with whole world a story. In the begining of this month I created web form. Added there some controls. Today I wanted to add one another control, and after my addition miracously controls at page disappeared. I was surprised, looked for ways to solve problem, and after wasted hours I decided to remove and add control again. Try to imagine my shock, when caption of DAC appeared back on page!!!!. So next time if caption disappears just remove and add control at "Page Layout" and it maybe will appear. I have no comments, just plenty of negative emotions. more

  • How pages in acumatica work

    Hello Everybody.

    Today I will speak about some trivial matters, which I found during usage reflector while analyzed received source code of acumatica.

    So lets go on.

    Each page of acumatica as base class PX.Web.UI.PXPage.

    Base page has the following declaration:

    public PXDataSource DefaultDataSource; 

    This explains why we need to describe graphe for DataSource. 

    Inside of disassembled code I found method IsPageCustomized, which looks in folder CstPublished in order to ched did page was customized.

    Another interesting feature is method OnInit which is overrided. It means that Acumatica adds controls to page by itself which is correct from viewpoint of ASP.Net pages lifecycle.

    But let … more

  • Acumatica modification existing tables with prefix Usr

    Hello everybody,

    today just a short hint. In case if you want to add some column in Acumatica DB, you should start field from usr prefix. For exaple if you want to add field Payrollcat, you should name it UsrPayrollcat. If you'll not use this advice, next update of Acumatica will remove your field, and you'll be very sad.

    For example you can use following template of code:

    IF EXISTS (SELECT * FROM SYS.columns WHERE name = N'UsrPayrollcat' and object_id = OBJECT_ID(N'PRPayrollDetails'))

    BEGIN

    PRINT 'EXISTS'

    END

    ELSE

    BEGIN

    Alter table PRPayrollDetails

    ADD UsrPayrollcat nvarchar(1) NULL

    PRINT 'Column UsrPayrollcat was … more

  • Add button to grid in Acumatica

    Hello everybody,

    today I want briefly share how to add button to Grid in Acumatica. Actually button without any dialogs. Just button with posibility to run C# code.

    Lets say you have grid, and want name for button Calculate. 

    Then in graph you should write something like this:

    public PXAction<PRPayroll> Calculate;

    [PXButton]

    [PXUIField(DisplayName = "Calculate")]

    public virtual IEnumerable calculate(PXAdapter adapter)

    {

    return adapter.Get();

    }

    And in grid something like this:

    <ActionBar ActionsText="True">

    <CustomItems>

    <px:PXToolBarButton>

    <AutoCallBack Command="Calculate" Target="ds" >

    </AutoCallBack>

    </px:PXToolBarButton> … more

  • Master details step by step

    Hello everybody,

    today I want to share how to implement master detail form step by step starting from small. So, recently I was in situation when I created form, generated DAC, created aspx page, and got some errors. When I asked support for help, they informed me that they will help me only one hour for free, and another hours for $$$$. I need to say that I appreciate communication with Acumatica support team, and I even ready to pay to them, but should admit it's not always easy to me. 

    So I decided to make another option. 

    1. Create very simple tables

    2. Create very simple DAC

    3. Add complication logic.

    Few words what means very simple. In my terms very simple is Table with key and … more

  • Saving changes are not permitted. Because the changes you have made require the listed tables to be dropped and re-created

    Small hack.

    If you modify table in Microsoft SQL Server Management Studio, it sometimes says something like 

    Saving changes is not permitted. The changes you have made require the following tables to be dropped and re-created. You have either made changes to a table that can't be recreated or enabled the option Prevent saving changes that require the table to be re-created. 

    Do you know where mentioned option is hidden?

    Tools -> Options -> Designers -> Table and DAtabase Designers. Find there checkbox Prevent saving changes that require table re-creation, remove checkbox and enjoy results. more

  • Lua for FXCM Trade Station

    Hello everybody,

    today I will share with you adventure of learning writing something for Trade Station from FXCM and some other trading companies.

    I got one request from client to write for him expert advisor, and it should be for Trade Station in lua, and not in mql4.

    I can't say that I was happy, but customer is sacred think, so I started.

    Initially I read the manual and realized that lua is simple language with C like syntax. AFAIK C, I decided to look how to develop EA.

    So I created file "matrade.lua" which was empty. 

    Then in trade station I made the following:

    Pressed at button import and pointed to my file:

    and as result got error message

    For me it meant following. In … more

  • Acumatica PXSplitContainer

    Hello,

    I want to share some discoveries about attributes of PXSplitContainer.

    <px:PXSplitContainer runat="server" ID="sp1" SplitterPosition="300" Height="100px">

    SplitterPosition="300" means that first item will have height 300 pixels

    Height="100px" I didn't notice any changes at page, so I have no idea, why on Earth it is. more

  • CreatedByID cannot be null in Acumatica

    Hello everybody,

    today I want to share how to cope with error message CreatedByID cannot be null and CreatedByScreenID cannot be null, and so on. In order to get rid of

    those error messages use attributes [PXDBCreatedByID], [PXDBCreatedByScreenID],

     [PXDBCreatedDateTime], [PXDBLastModifiedByID], [PXDBLastModifiedByScreenID], 

     [PXDBLastModifiedDateTime], [PXDBTimestamp]. 

    If somebody has a question, how I got such error message, the answer is simple. DAC generator generated those fields for me without those attributes, so only with the help of reflector I realized how to fix my issue. more

  • Cannot insert explicit value for identity column in table when identity_insert is set to off in Acumatica

    Hello everybody,

    today I received the following error message in Acumatica:

    Cannot insert explicit value for identity column in table when identity_insert is set to off.

    After executing SQL

    SET IDENTITY_INSERT table off

    problem wasn't solved, so I needed to search deeper. After attaching with SQL Profiler, I noticed that Acumatica generated SQL, which tried to insert null into key field. Then was time to look in manual. 

    And then I noticed that for key fields statement IsKey = true is not used. Instead is used 

    [PXDBIdentity]

    So I replaced [PXDBInt(IsKey = true)] with [PXDBIdentity] and problem disappeared. more

  • GoFirstRecord and Configuration screens in Acumatica

    Hello everybody,

    today I want to share with you one of my mistakes. 

    Few days ago I started to develop Configuration screen, or screen which should end at xx101000. After I completed it and passed for testing I faced a challenge. The page should display only the first record. So I implemented some logic which selected the first record. After that I re-read one of the manuals and found that DataSet have property PageLoadBehavior which can be set to GoFirstRecord!!!!

    After I removed my code which loaded first record, and added beforementioned property my configuration screen behaved as really configuration screeen.  more

  • Saving complex objects in Acumatica

    Hello everybody,

    today I want to share one nesessary step which is needed for graph in order to save graph which has more then one DAC ( data access class ).

    In my case I have DAC PRPayRoll, which is joined with classes PRPayrollDetails, PRPaySlip, PRTran.

    In that case it is needed to mention in graph declaration primary dac.

    So instead of writing 

    public class PayRollManager : PXGraph<PayRollManager>

    I wrote

    public class PayRollManager : PXGraph<PayRollManager, PRPayroll>

    Where PRPayroll is primary DAC. Or if to quote Acumatica manual PRPayroll is primary DAC for business logic container more