Archives

Archives / 2018
  • How to use column name in DB that differs from field name in DAC class

    Hello everybody,

    today I want to leave a short workaround for the following case:

    you have DAC class, with column Data, but in db you have column BlobData. How to map your BlobData on Data? For such case you can use attribute DatabaseFieldName.

    Take a note, how Acumatica used it:

    [PXDBBinary(DatabaseFieldName = "Data")]

    public virtual byte[] BlobData { get; set; } more

  • Technology is not the biggest threat to the bank

    In this article I want to express my opinion on why I disagree with title that technology is threat to the bank of Antony Jenkins.

    First of all, I'd like to point that anything that is new, can poses a threat to something, that already exists on the market. And task of those which exist is either to use it, or they will be forced to close themselves.

    First subheading of Antony is job losses of bank workers. I definitely agree that job losses of bank workers will happen. And absolutely agree that job losses will happen because of improvement of data collecting, AI process data faster etc. But I disagree that such a think poses any threat to bank. I can say even opposite, such job loss … more

  • Investments terms in Real estate

    Hello everybody,

    today I want to document some terms related to real estate investment with simple words.

    NOI or Net operating income

    NOI or net operating income is income after all expances but before morgage payment ( in case of real estate ). 

    Cap rate

    Cap rate or capitalization rate is something which says what profit you'll get in percentage from benefiting something that you use during one year.

    I assume with example it will be easier to understand.

    Suppose, you want to buy a flat which you plan to give as a rent for others.

    You pay for buying a flat 40 000$. Monthly rent of flat income after paying all bills is 350$. What is cap rate ( capitalization rate )? Below goes the … more

  • How to send email via Acumatica notifications mechanism

    Hello everybody,

    Today I want to share a note on how to send email via Acumatica notifications mechanism:

    var sender = new NotificationGenerator

    {

        To = "someone@example.com",

        Subject = $"Subject information {DateTime.Now:d}",

        Body = "Body od message",

        BodyFormat = EmailFormatListAttribute.Text

    };

    sender.Send();

    With such code, Acumatica will send email.

    more

  • Notes on Acumatica developers summit 2018

    Hi all,

    Recently I visited virtual developers conference for Acumatica.

    Here I want to document some details that were mentioned during that summit.

    First of all, I'd like to say that idea from Gabriel Michaud about making some global functionality for each page.

    Using PXGraph extension for creating a global button

    Consider for example how to implement a global button using PXGraphExtension:

    public class GloalGraphExtension : PXGraphExtension<PXGraph>

    {

        public override void Initialize()

        {

            if (!string.IsNullOrEmpty(Base.PrimaryView))

           {

               //Add a "Test" button in the toolbar    

               Type primaryViewItemType = Base.Views[Base.PrimaryView]. … more

  • Acumatica developers conference 2018 part 1

    Hello everybody,

    I want to summarize what I've seen and heard at latest Acumatica Developers conference.

    First of all, I'd like to say that idea from Gabriel Michaud about using of attributes that can save plenty of time during development.

    Part 1

    Everyday trips and tricks (Magic attributes and BQL operands)

    Lets start. For examle how to make a field required (or visible, or enabled) dynamically:

    Traditional way (old version):

    protected virtual void SOOrder_RowSelected(PXCache cache, PXRowSelectedEventArgs e)

    {

        SOOrder doc = e.Row as SOOrder;

        if (doc == null)

        {

               return;

        }

        if (doc.OrderType == "SO")

        {

              PXDefaultAttribute. … more

  • Microsoft Chart basic elements

    Hello everybody,

    recently I've found Microsoft Chart elements description picture, and was very much surprised with it. So I've decided to leave picture at mine blog as well.

    First of all take a look at those elements on the picture;

    Description of Chart Details

    Axis Label

    Labels along axis.

    Axis TitleThe title of an axis.

    Chart AreaThe chart picture consists of one or more chart areas, which are rectangular areas that are used to draw series, labels, axes, grid lines, tick marks, and so on. Multiple series can be plotted in one chart area, depending on the chart types involved.

    The plot area, used to plot chart data, is also contained within a chart area.

    Chart PictureThe chart … more

  • Select distinct values in Acumatica selector

    Hello everybody,

    today I want to post how to make distinct select from some column in Acumatica.

    So, imagine that you've decided not to normalize some column for Acumatica to SOOrder class. For example like this:

    public class SOOrderExt: PXCacheExtension<SOOrder>

        {

            #region Region

            public abstract class region : IBqlField

            {

            }

            [PXDBString(255)]

            [PXUIField(DisplayName = "Region", Visibility = PXUIVisibility.Visible)]

            public virtual string Region { get; set; }

            #endregion

    Then in other place, if you need to make distinct selector for Region, you can use code like this:

    #region Region

     public abstract class region  … more

  • How to speedup parallel processing in Acumatica

    Hello everybody,

    recently I've get advice from Acumaitca on how to speed up parallel processing of sales orders creation with usage of Multithreading. Their advice was to add following line in web.config:

        <add key="AsyncNumbering" value="true" />

    With that line your Acumatica graphs will have separate numbering sequences which can create some gaps in your numberings, but definetely speed up creation of new lines. more

  • Abbreviations in Warehouse management

    Hello everybody,

    today I want to leave a note on warehouse abbreviations. For me all of them are not easy to keep in mind, so I decided to post them here:

    Abbreviation

    Meaning

    3PL

    Third party logistics

    ADC

    Automated data collection

    APS

    Advanced planning & scheduling

    ASN

    Advanced shipment notifications

    ASRS

    Automated Storage Revival system

    ASP

    Application service provider

    ISV

    Independent software vendor

    AIDC

    Automatic identification and data collection

    BOM

    Bill of material is a list materials required to produce an item

    CCD

    Charged coupled device is a barcode scanner that takes digital image of the barcode instead of … more

  • Some properties of graph in Acumatica

    Hello everybody,

    today I want to mention few interesting properties of Graph in Acumatica:

    IsImport

    IsExport

    IsMobile

    Names are pretty self-explanatory, but let's go a bit deeper.

    IsImport

    Imagine following situation: you created some code in graph, and have huge desire to add some logic, which will be executed only when it is used in Import mode. For example in case of import you'd like not to add discount. How to tell this to Acumatica? For example like this:

    if (!sender.Graph.IsImport) AddDiscount(sender, doc);

    This will tell to Acumatica not to add discount to your entity during Import.

    IsExport

    Another use case. Imagine, that you want some logic to be executed during … more

  • Prediction customization

    Hello everybody,

    here I want to describe in more details what I mean when I say prediction customization.

    As name says by itself, I want to make something that will help you to make predictions. 

    Predictions for what? 

    Acumatica has plenty of entities: invoices, sales orders, employees, taxes, acounts payable, acounts receivable, fixed assets, etc. I want to make customization, that will use some machine learning techniques in order to say something like: in the next month based on history of your your sales, you'll have 2000 sales orders. Or based on your current history, you'll pay 300 000 taxes in the next two months. Or based on your history of hiring, in next three years you'll … more

  • Acumatica clipboard functionality

    Hello,

    today I want to drop few lines about working with copy/paste functionality of Acumatica.

    For full canceling insertion from Clipboard, you can use the following in your graph:

    public override bool CanClipboardCopyPaste()

    {

    return false;

    }

    Also you can use attribute PXCopyPasteHiddenFields. That attribute says that specified fields of the primary DAC of the data view will no be copied when the copy-paste feature is used.

    Another attribute which you can consider is PXCopyPasteHiddenView. This attribute says that cache corresponding to the primary DAC of the data view is not copied when the copy-paste feature is used.

    And one more useful fields in graph itself is … more

  • Make printing of one table per page with CSS

    Hello erybody,

    today I want to share one important note, which took significant amount of time from me to finish.

    I had page which as html output few tables. For me it was nessesary to make one page per table. In order to achieve it I've found following CSS:

    <style>

        table,

        table tr td,

        table tr th {

            page-break-inside: avoid;

        }

    </style>

    That was only one css that worked for me.

    more

  • How to add Database context to Filter in .Net Core 2.0

    Hello everybody,

    today I want to write a short description on how to add database context to IAuthorizationFilter.

    Imagine that you have following filter:

    public class HasApprovedFilter : Attribute, IAuthorizationFilter

    {

        private SomeDbContext _context;

        public HasApprovedFilter(SomeDbContext context)

        {

            this._context = context;

        }

        public void OnAuthorization(AuthorizationFilterContext context)

        {

            var user = context.HttpContext.User;

            if (!user.Identity.IsAuthenticated)

            {

                return;

            }

            var userAdd = _context.;

            //var um = context.HttpContext.RequestServices.GetService();

        }

    } … more

  • Types of fliters in .Net Core

    Hello everybody,

    today I want to make a short document about filters in .Net Core.

    There are by default four types of filters:

    Filters that implement IAuthorizationFilter which allow us to implement OnAuthorization method which allow us to add custom security logic.

    Filters that implement IActionFilter has two methods: OnActionExecuting, OnActionExecuted. Those two methods executed before and after action executing.

    Filters that implement IExceptionFilter has method OnException, which allows to handle exceptions.

    Filters that implement IResultFilter has two methods: OnResultExecuting, OnResultExecuted.

    Filters can be applied at controller or at action level. That gives following … more

  • How to override part of C# code in Automation Steps in Acumatica

    Hello everybody,

    today I want to share one interesting gotcha which took plenty of efforts from mine side in order to understand it.

    Recently I got an assignment to modify behaviour of Create Prepayment action at purchase orders. 

    If to look at CreatePreapyment implementation, it has following part of code:

    if (this.Document.Current == null)

      return;

    this.Save.Press();

    APInvoiceEntry instance = PXGraph.CreateInstance<APInvoiceEntry>();

    if (this.Document.Current.PrepaymentRefNbr == null)

    {

    if to put simply it checks if current purchase order already has a prepayment, and in case if it has, then give to a user error message. 

    Imagine, that you need to modify that behaviour for … more

  • How to override Create Prepayment in Acumatica without usage of custom delegate

    Hello everybody,

    today I want to share with you on how to override Action CreatePrepayment in Acumatica.

    General rule of overriding methods in Acumatica according to T300 manual is like this:

    Create delegate.

    Add [PXOverride] over your method which is named exactly as base method ( in our case CreatePrepayment )

    Add your implementation

    For example you can achieve it like this:

    //Create your delegate

    public delegate void CreatePrepaymentDelegate();

    [PXOverride]

    public void CreatePrepayment(CreatePrepaymentDelegate baseDel)

    {

        // your code of overriding

    }

    Way from manual T300 is perfectly workable, but  I propose you to use feature of .Net which is named Action, … more

  • Creating custom Autonumber which will be auto generated ID in Acumatica

    If you want to create custom Attribute for autonumbering field you need:

    Create Setup page for configuring autonumbering field or maybe you can use existing

    Create Attribute which you'll add to your entity

    Add attribute to field that you need increment 

    Create Setup page for configuration autonumbering field

    Setup.cs like this:

    [System.SerializableAttribute()]

        [PXPrimaryGraph(typeof(CurrencyMaint))]

        [PXCacheName("Your company Preferences")]

        public class Setup : PX.Data.IBqlTable

        {

            #region DocumentRefNbr

            public abstract class documentRefNbr : PX.Data.IBqlField

            {

            }

            protected string _DocumentRefNbr;

            [ … more

  • Entity Framework one to many relationship

    Hello everybody,

    today I want to make short post on how to confiugre one to many relationship in Entity Framework 6.

    Imagine following: One group can have multiple students. So one to many relationship. For this purpose you can use following convention configuration agreement:

    public class Student

    {

        public int StudentId { get; set; }

        public string StudentName { get; set; }

    }

    public class Group

    {

        public int GroupId { get; set; }

        public string GroupName { get; set; }

        public string Department { get; set; }

        public List<Student> Students { get; set; }

    }

    In presented example class group includes navigation property Students. 

    Another convention is … more

  • Complete description of arguments in jForex submitOrder

    Hello everybody,

    here I want to leave fragment of code related to submitOrder:

    public void onStart(IContext context) throws JFException {

    IEngine engine = context.getEngine();

    IHistory history = context.getHistory();

    Instrument instrument = Instrument.EURUSD;

    context.setSubscribedInstruments(java.util.Collections.singleton(instrument), true);

    ITick lastTick = history.getLastTick(instrument);

    double price = lastTick.getAsk() + instrument.getPipValue() * 5;

    double sl = lastTick.getAsk() - instrument.getPipValue() * 20;

    double tp = lastTick.getAsk() + instrument.getPipValue() * 10;

    long gtt = lastTick.getTime() + TimeUnit.SECONDS. … more

  • New class in Acumatica: PXImpersonationContext

    Hello everybody,

    here I want to document new scope in Acumatica: PXImpersonationContext. 

    As often is the case try to look at presented code:

    var thr = new Thread(

                                       () =>

                                       {

                                           try

                                           {

                                               using (new PXImpersonationContext(PX.Data.Update.PXInstanceHelper.ScopeUser)).

    .

    .

    }

                                foreach (var thread in threads)

                                {

                                    lock (thisLock)

                                    {

                                        thread.Start();

          … more

  • Manage serialization in .Net Core 2.0

    Hello everybody,

    today I want to write a short notice on how to manage uppercase/lowercase options for serialization in .Net Core.

    In mine practice I often had situation, when javascript or typescript code sends me some staff in lowercase class names, but in C# I'm used to Upper case class names. 

    Another option that you sometime can need is switching between xml and json serialization. How those options can be managed in .Net Core 2.0 ?

    For both of those options ( and even more ) you can use pipeline management of Startup class of ConfigureServices method.

    For example if you need to have xml serialization output you can use following code:

    public class Startup

        {

            // This  … more

  • Some notes on Jira usage

    Hello everybody,

    today I want to make a short recording of the following video: Introduction to Jira & Agile and Project management.

    Actually I just want to have short text version of Dan Chuparkoff's  advices.

    Task is something that is bigger then 30 minutes but smaller then 3 days to complete. It is practical don't have tasks that take more then one day to do.

    You can't wait in the middle of the task. If you are waiting in the middle of the task, then take another look, maybe you have series of tasks. 

    You can be in three modes: in progress, done, not started.

    Estimating is hard, but use estimates. And use story points, not the hours. 

    There are different kinds of story points.  … more

  • Ridge regression in C# with help of Math .Net Numerics

    Hello everybody,

    today I want to share a piece of code that took me almost few months of learning in order to implement it. It is Ridge regression. Below goes code that gives you weights for Ridge regression:

    public double[] RidgeRegression(double[][] xTrain, double[] yTrain, double lambda = 0.1)

    {

        var M = Matrix<double>.Build;

        var x = M.DenseOfRowArrays(xTrain);

        

        var ones = Vector<double>.Build.Dense(x.RowCount, 1);

        x = x.InsertColumn(0, ones);

        var y = Vector<double>.Build.DenseOfArray(yTrain);

        var xt = x.Transpose();

        var lambdaIdentity = lambda * M.DenseIdentity(x.ColumnCount);

        var sumDot = xt.Multiply(x) + lambdaIdentity;

        var  … more

  • Linear regression behavior with free weight

    Hello everybody,

    recently I've decided to implement some ML library in C#. But mine ultimate goal of that C# library was to make it use as much as possible TPL features of C#. 

    I'm aware about other ML libraries, but as often is said, if you wish to understand how some ML algorithm works, program it by yourself. I've decided to start with Linear regression.

    Here you can see how mine library utilizes processor:

    as you can see it uses 85% of mine 4-cores CPU, which is impossible with only one thread running.

    First step for me was to understand how that algorithm works. In order to understand it I've took course Machine Learning Specializationfrom University of Washington.

    I'll omit … more

  • Practical value of unit tests

    Hello everybody,

    Here will be another interesting benefit of writing unit tests which I've discovered recently for myself. 

    Simplified testability

    Imagine, that for you as for developer arrived some kind of bug. After investigation you've found that bug is caused with imporper method functionality. How can you fix method without unit tests? Way will be like this:

    Add code fix

    Execute application and make effort to re-prodcue bug

    If bug is not re-produced, you make commit/push and enjoy life

    If bug is not fixed, go to steps 1 - 3 one more time.

    Here is how those steps can look like in unit test:

    Add unit test that feed into method with bug wrong values

    Add fix to code … more

  • Some notes on xUnit usage

    Hello everybody,

    today I want to share with you small explanation about how xUnit works. 

    Take a look at presented code:

    [Theory]

    [InlineData(3, 4, 5)]

    [InlineData(7, 8, 9)]

    public void MethodDemo(int numberOne, int numberTwo, int numberThree)

    {

        double[][] data = new double[1][];

        data[0] = new double[3];

        data[0][0] = numberOne;

        data[0][1] = numberTwo;

        data[0][2] = numberThree;

        var sut = new Matrix(data);

    }

    If to describe this code in words, it has following meaning. 

    Attribute Theory says that it is test method which should be exeuted.

    Repeated twice Attribute InlineData says that method MethodDemo should be executed twice, with assigning to … more

  • Access rights in Acumatica

    Hello everybody,

    today I want to leave a short notice on how access rights work in Acumatica. So, if to enumerate them, there are following access permissions: revoked, select, update, insert, delete. 

    If to enumerate them in the list of smallest permissions to biggest, it will be list like this:

    Revoked - user can't see or edit

    Select - user can see, can't edit

    Update - user can see and edit

    Insert - user can see, edit, create new

    Delete - user can see, edit, create, delete

    So, if you configure permissions, and want to give highest level, then give Delete. But if you want to protect system from accidental deletion, then most probably you'll need give them Select set of … more

  • C# async/await usage

    Hello everybody,

    today I want to describe in simple words what C# does for .Net cases in IIS.

    Before I continue, I want to point the following. As usually IIS has 500 threads. It means that one IIS server can simultaneously server 500 customers. Keeping this idea in mind

    take a look at the following code:

    [HttpGet]

    public IEnumerable<string> GetSync()

    {

        string val1 = "value" +  LongRunningMethod().ToString();

        string val2 = "value2";

        return new[] { val1, val2 };

    }

    private int LongRunningMethod()

    {

        Thread.Sleep(10000);

        return 10;

    }

    and imagine that you have 600 customers simultaneously. For 500 lucky users of your web site it will mean that their … more

  • Import export data between different SQL servers

    Hello everybody,

    today I want to share some information on how to import some big chunks of data from one server to another. Need for this movement for me personally arised when I had a need to transfer big amounts of data on a regular basis. Big amount means 2.5 millons of records. My first apporach was to use SQL Server 2017 Import and Export Data. Initially I've used 32 bit tool, and found out that I sometime face strange error messages. After some googling I've found that for big volumes of data it's better to use SQL Server 2017 Import and Export Data 64 bit. 

    and all of the sudden strange configuration errors, drivers lack error, ODBC driver error had leave me. 

    So, one of the … more

  • Some notes on usage Table variables

    Hello everybody,

    today I want to share some fragment of SQL, that I've used for updating tables in Acumatica.

    First of all, I'd like to show table variable that I've created:

    DECLARE @SalesOrderInformation TABLE

    (

      OrderType nvarchar(2),

      OrderNbr nvarchar(12)

    )

    It has nothing special, just two fields: ordertype and ordernbr. 

    I need them as temporar storage for future update. T-SQL allows to use two kind of temporary tables: table variable and temp table, which starts from #.

    I prefer table variables for the following reasons:

    1. Performance. Because limited scope, as usually performance fo table variables is faster then temp tables. 

    2. Temporary tables instead of table … more

  • GDPR trainint certificate

    Hello everybody,

    today I want to share a screenshot of GDPR training completion and a few words about training from Business Fraud Prevention Partnership.

    First of all, I'd like to say that Business Fraud Prevention Partnership made a great explanation of what GDPR is, and what it is not. 

    I've enjoyed from the way how they split information. They used for splitting differnet wordings, picures which made it easy to memorize information. 

    Prior to taking their course I've spent some time reading about GDPR, but if I just read without any quiz in the end, most probably information will move in brain in some passive mode and that's it. But with their tests it will stay longer and will be … more

  • How to set some value in Acumatica screen and tell about it to Acumatica

    Hello everybody,

    today I want to write a short note about persisting something to Acumatica.

    Sometime it happens that in your code you have something like this:

    SomeDacInstance.Field = somevalue;

    and following workflow:

    User clicks on save, you code is executed, you go in record, refresh page and surprise: somevalue is not there. How to deal with it? In such cases you'll need to use method SetValueExt.

    For example one of readers of mine blog had the following code:

    row.LotSerialNbr = modificado2;

    cache.Insert(row.LotSerialNbr)

    but that approach didn't save value for two reasons:

    1. simple assign of value doesn't tell acumatica cache about any changes.

    2. Inserting something … more

  • Required instead of current in Acumatica

    Hello everybody,

    today I want to fulfill my promise that I gave to one of my readers. 

    He left at mine blog following question:

    How do we use required<> in place of current<> and pass some string constant for selector? That question was asked in context of this article. 

    That is good question and I also want to add that answer on it will be at least to some degree disappointing. First of all, if you work with selectors, you can't use Required. Required is intended for use in Graphs.

    But if you want to use some constant filtering conditions, you don't need Required attribute at all. You can use mechanism of Constants, which works perfectly without Required. 

    Take a look at the … more

  • How to insert correctly new Sales order into Acumatica with external graph

    Hello everybody,

    today I want to write a short notice on how to create new sales order in Acumatica properly.

    So, first of all take not that SOOrder type has two keys. One key is or order type, and second key is for OrderNbr.

    It means that you can't do code like this:

    var newSOrder = sOEntry.Document.Insert();

    sOEntry.Document.SetValueExt<SOOrder.orderType>(sOEntry.Document.Current, sorder.AcumaticaOrderType);

    or actually you can, but later you'll face some issues with duplicated sales orders ( as I recently faced ).

    But what you should do if you wish create new Sales order is the following code snippet:

    var newSOrder = new SOOrder();

    newSOrder.OrderType = sorder.AcumaticaOrderType; … more

  • Cross validation. Sklearn.model_selection, sklearn.cross_validation

    Hello everybody,

    today I want to describe a bit more about cross validation and how to work with it in Python. Here I describe how to split learning set once or how to use different cross validation strategies. 

    Before I'll continue, I'd like to describe different types of splitting data for training. 

    There are following ways to split data:

    1. Split on 70/30 ( sometime 80/20 ) on two sets: Training data, Validation data. 

    You train data on training data, and validate on holdout data. 

    This approach has following pros/cons:

    (+) model is trained only once

    (-) depends from the splitting

    (+/-) works fine for big data sets

    In order to understand one more case take a look at … more

  • Built in data sets in Sklearn and visualization with Pandas

    Hello everybody,

    today I want to write a few words about built in data sets in sklearn library of python but from Visual Studio 2017 prospective. You may ask why Visual Studio 2017 if there are plenty of other options? I can say that main reason is becuase I like debugging features that availabile in Visual Studio which make my life much simpler. 

    Initial headers and one function

    So, before we continue, we need as usually in Pythong import some basic libraries. You can do it in Visual studio like this:

    import sklearn

    from matplotlib import pylab

    import matplotlib

    import matplotlib.pyplot as pyplot

    import numpy as np

    from sklearn import datasets

    def sanitize_sequence(data): … more

  • Different kinds of tests

    Hello everybody,

    Today I want to write a really short description of different kind of tests, which can be perfomed by code.

    Unit test: Specify and test one point of the interface of single method of a class. This should have a very small and well described scope. Complicated dependencies and activities to the outside staff are stubbed or mocked.

    Integration test: Test the correct co-operation of multiple subsystems. There is whole ecosystem here, from testing integration between two classes, to testing integration with the production environment.

    Smoke test (AKA Load test, AKA Sanity check): A simple integration test where we just check that when the system under test is … more

  • How to check Automation step settings in Acumatica

    Hello everybody,

    today I want to describe some tricky feature of Automation steps. 

    Quite often in Acumatica I face interesting challenge. I've added some code in Row_Selected, open some screen, and to mine disappointment I find that screen totally ignores mine code. What can stand behind such weird behaviour?

    One of the explanations can lie behind automation steps. If to put simply, automation steps is a feature of Acumatica, that allows to program it without any usage of C# code. All that is needed from you as Acumatica user is just add via GUI designer staff on the form and then via automation steps configure it's behaviour. 

    So, let's consider some details, that can help you to … more

  • C# feature nameof

    Hello everybody,

    today I want to share with you one cool feature of C#.  It is nameof. Take a look at the following code:

    var abc = 3;

    var varName = nameof(abc);

    How do you think, what will go into varName? It will be equal to "abc". Probably you can puzzle why on earth I can need such an operator?

    Consdier following cases:

    1. If you work with reflection, then instead of rely on hard coding names of fields, you can rely on compiler to subsitute it instead of you. 

    class Program

    {

        public class NameOffDemo

        {

            public string SomePropertyOne { get; set; }

            public string SomePropertyTwo { get; set; }

        }

        static void Main(string[] args)

        {

             … more

  • PXPrpojection, Data Projection what is it?

    Hello everybody.

    Imagine that you need to have implementation of several tables with possibility to update them all. 

    Also you want to implement by the Acumatica side rather than by the database.

    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?

    So, yes we can do it. For this purpose Acumatica gives you PXprojection attribute.

    PXProjection attribute  binds the DAC to an arbitrary data set. The attribute thus defines a named view, but is implemented by the server side rather than by the database.

    Lets start)

    Steps:

    Think whats tables you … more

  • Amazon storage

    Hello everybody,

    today I want to write a few words about Amazon storage. 

    So, first of all I'd like to say that Amzaon provides to kinds of storage: 

    Ephemeral

    S3

    If to speak about ephemeral, then I can say that main purpose of this storage is temporary storing of your data. If to compare ephemeral storage with S3 it has following limitations:

    access speed is not guaranteed

    there is not service level agreement for this service

    You can use ephemeral storage for the following staff:

    buffer

    cache

    scratch data

    etc...

    Let's talk now about S3. Question 1, why it is named S3? Amazon Simple Storage Service, or three letters S. 

    it has following features:

    Accessible via … more

  • Inventory items images structure in Acumatica

    Hello everybody,

    today I want to document some information about how images for inventory items are stored in Acumatica. 

    Database structure (Acumatica)

    InventoryItem - A table that contains all InventoryItem data

    > ImageURL - A data field where the image file name being saved.

     

    UploadFile - A table that contains attachments data

    > Name - A data field where you can use to join with InventoryItem using InventoryItem.ImageURL = UploadFile.Name

     

    NoteDoc - A table that contains all NoteDoc data

    > FileID - A data field unique ID where you can use to join with UploadFile using UploadFile.FileID = NoteDoc.FileID

     

    A SQL query that get data necessary to create the imageExternalLink … more

  • How to construct complicated queries in BQL of Acumatica

    Hello everybody,

    today I want to describe the following situation. Imagine that you have to write following SQL statement in Acumatica:

    SELECT InventoryItem.InventoryCD, InventoryItem.imageUrl, UploadFile.Name, NoteDoc.FileId, * FROM InventoryItem

    LEFT JOIN UploadFile ON InventoryItem.imageUrl = UploadFile.Name

    LEFT JOIN NoteDoc ON UploadFile.FileID = NoteDoc.FileID where imageurl is not null

    I myself prefer to have way to write a code that is easy to modify and maintain. So instead of creating one big BQL statement I'd like to make it as few smaller statements. Is it achievable with Acumatica BQL? Yes, it's achievable. Take a look at following code that does exactly what I've … more

  • How to set command time out part 2

    Hello everybody,

    today I want to document few ways on how to modify command time out. Sometime it may happen that you have some kind of long runnig queries, and at some particular graph you may want to make it live longer. 

    For such purposes very convenient is PXCommandScope object. Below goes code sample that allow you to achieve this purpose:

     using (new PXCommandScope(PXDatabase.Provider.DefaultQueryTimeout * 2))  // increasing 2 fold {               var results = PXSelect<BAccount>.Select(this); }

    with such code you can get twice a time for your BQL statements.  more

  • Monitor diagnostics window of Visual Studio

    Hello everybody,

    today I want to share interesting feature of Visual studio Diagnostics Tools window. 

    Take a look at picture below:

    as you can see on the picture it has plenty of gray diamonds with few red ones. Try to guess, what is purpose of red diamonds or red rhombs? It shows that some exception happend during exectution and also if you point cursor of mouse on that diamond, it will show you text of exception. Pretty cool, huh ?

    more

  • How to increase display size of items in SQL server management studio

    Hello everybody,

    today I want to document one interesting feature of SQL Server management studio. Some time it happens, that you work with big XML data files.

    For example if you have sql statement like this:

    SELECT @xm=( select rowid, count(rowid) as IdsNumber from SOLine s where s.rowid like 'fdsafewvvcxkfdsla'fslf%' group by rowid for xml raw, root) select @xm

    in SQL server management studio and would like to increase size that is workable by SQL server management studio. I found that following value in system registry is very helpful:

    HKCU\Software\Microsoft\SQL Server Management Studio\14.0_Config\XmlEditor\MaxFileSizeSupportedByLanguageService

    set it's value to 100 and you'll … more

  • How to modify Query timeout in Acumatica

    Hello everybody,

    today I want to share with you some trick which I used for cases if I get error message that some select from Acumatica timed out. Sometime if you work with big tables ( ~2 millions of records ) you may face timeout errors. Especially it is troublesome for processing screens when you are ready to wait for some kind of functionality just in order to be complete. Let me introduce you to property DefaultQueryTimeout of PXDataBase.Provider static class. By default it's value is set to 90, which means that it will be executed by sql server for 90 seconds. I should admit that for majority of cases it is more then enough. Except for cases when you need to fix some bugs in code. … more

  • Convenient parsing of XML nodes in C#

    Hello everybody,

    today I want to share with you code that I use in order to conveniently to parse different xml nodes in C#. 

    Take a look at this class:

    public static class XmlNodeProcessor

        {

            public static int? ParseInt(this string s)

            {

                if (string.IsNullOrEmpty(s))

                {

                    return null;

                }

                return int.Parse(s);

            }

            public static long? ParseLong(this string s)

            {

                if (string.IsNullOrEmpty(s))

                {

                    return null;

                }

                return long.Parse(s);

            }

            public static Guid? ParseGuid(this string s)

            {

          … more

  • Create customization to MYOBAdvanced(Acumatica), part 3 сreate customization and publish it

    So, continue the work:) 

    Part 3 сreate customization and publish it

     Create customization

    To create customization for import to MYOBAdvanced (acumatica) I need go to Customization - Customization Project and add new customization (Screenshot 10):

    In this example I use design of acumatica ( add screen, add page,  files and scripts) see Screenshot 11.

    Also I add sql script that will add new column "UsrBodyWithoutHtml" to table "CRActivity" (Screenshot 12"):

    After this click on "Publish"; I see whether validation has passed and there are no errors. If all ok I can close window and click export customization. ActivityCustomization.zip folder will be downloaded.

           

        … more

  • Create customization to MYOBAdvanced(Acumatica), part 2 сreate page, graph, DAC class extension and xml page for mobile

    So, continue the work:). Part 1 is here.

    Part 2 сreate page, graph, DAC class extension and xml page for mobile

    First of all, In project I create folder "DAC" and add two clasess:

    ActivityTypes.cs

    This class need to filter types rows from table CRActivity(column name - Type). Client asked display all events for that Business Account of type "Phone Call", "Client Visit" and "Futile Visit" So for this I do next:

    public static class ActivityTypes

       {

           public const string F = "F";

           public const string M = "MEET";

           public const string P = "P";

           public class fType : Constant<String>

           {

               public fType()

                   : base(F)

               … more

  • Create customization to MYOBAdvanced(Acumatica), part 1 description of the task, prepare to start

    I want to tell you some little history about how was created customization to existing MYOBAdvanced (Acumatica) project.

    One guy who buy and use acumatica from MYOBAdvanced (myob.com), asked me to create customization.

    He wrote:

    "

    The standard platform under Business Accounts has the Activities tab, which is where we record the data. Refer to attached screenshot.

    I need a search page as follow on the app/mobile device:

    Search field which only searches the Business Account Name field. 

    The user enters text, then Business account names that match that text are displayed, the user then selects the required account.

    The page then display all events for that Business Account of type " … more

  • How to separate Automation schedules in Acumatica

    Hello everybody,

    take a loot at the following picture:

    Let's say that you would like to have two Acumatica instances connected to the same database. Is it possible? Definetely yes, just with pointing both of them to the same connection string and you'll get some kind of scalability. 

    But imagine that your Acumatica has execution of some automation schedules. How to make sure, that only one of them will be executor of Automation schedules, not both of them?

    Very simple. Just add this key to web.config of Acumatica which should not be Automation schedules executor:

     <add key="DisableScheduleProcessor" value="True"/>

    Default value of DisableScheduleProcessor key is false, so you need … more

  • How to modify Stock Item screen ( IN202500 ) in Acumatica with adding master detail selectors

    Hello everybody,

    today I want to describe how to extend Stock Item screen IN202500 in Acumatica. Imagine that you need to add to tab General settings two selectors. Suppose that you need to have two selectors:

    as you can see following need to be achieved:

    To tab General Settings it is needed to add selectors: "Clase articulo web" and "Subclase articulo web".

    In case if selector "Clase articulo web" changes, then "Subclase articulo web" should show some other values.

    The first step should be start Acumatica developer project as described here.

    For cases if we have dependency of one selector from another it is possible to program in two ways:

    Custom selector for dependent code. … more

  • Clock

    Hello everybody,

    today I want to leave a note about one of mine customers. And you know, as soon as I've started to write this post I've caught myself that I can't name one person for whom I provide services for money with word customer. Please continue reading and you'll grasp what I mean. 

    Have you ever wonder how it could happen that Steve Jobs, guy that is not a designer, not UI-UX designer could orchestrate development of such cool devices? I always dreamed to meet such a person in life, not just read about them in wikipedia, or to read their books. And I can say that recently I've meet such a person. 

    Everything started from project that he asked me to create. And of course, I'm … more

  • Operator IN in BQL

    Hello everybody,

    today I want to write a few words about operator in which was presented in SQL for long ago, but weren't available in Acumatica BQL. But time goes on and now you can use it. For example like this:

    Object[] values = new String[] { "BXW000004", "BXW000005" };

                    POOrder item = PXSelect<POOrder,

                        Where<POOrder.orderNbr, In<Required<POOrder.orderNbr>>>>.Select(Base, values);

    that code will generate following sql statement:

    Select * from POOrder POOrder Where POOrder.OrderNbr In ('BXW000005', 'BXW000004')

    Order by POOrder.OrderNbr

    I can say that such approach simplifies some tasks that require dynamic passing of arguments.

    more

  • Functions map, zip and lambda in Python

    Hello everybody,

    today I want to describe three elements of Python: map, zip, lambda and *.

    Zip and *

    The first step that I want to describe is zip and * usage. Take a look at the following code:

    a = [5, 6]

    b = [7, 8]

    c = zip(a,b)

    print(*c)

    How do you think, what will be output, if I'll tell you that zip function zips arrays? If your guess is (5, 6) (7, 8) then unfortunately you are wrong. Output will be the following:

    (5, 7) (6, 8). I suppose that zip name was chosen because as usually zippers on clothes as usually vertical. Zip functions "zips" elements by columns, like presented on the picture:

    Now one more question, what is purpose of * ? It tells to Python interpreter to … more

  • Scaling Acumatica horizontally

    Hello everybody,

    today I want to share one interesting piece of information about horizontal scaling of Acumatica. I mean as usually for majority of people it is clear that Acumatica can work on one machine when DB, IIS and Acumatica lives on one machine. 

    One more variant of scaling can be when you have IIS with Acumatica on one machine, and DB on another machine. It can look like this:

    Here User lives on his machine, Acumatica ERP server lives on second machine, and site database lives on third machine. That is pretty good working schema especially for cases if you need vertical scalability.

    But recently I've discovered little bit more horizontal scalability for Acumatica which … more

  • How to merge precision and recall

    Hello everybody,

    today I continue writing notes about measuring quality of learning. You can read my previuos artcile 1 and article 2 about measures of quality of learning. If to summarize two of those articles we have the following:

    accuracy is good measure, but if samplings is unbalanced then accuracy can have great numbers, but total model will be very bad.

    precision tells you how objects model a(x) can find

    precision and recall work fine on unbalanced samplings

    And then question arises, is it possible somehow to merge them, but not as accuracy but as something more meaningful then accuracy?

    I'll decribe different ways to describe it going from worsest to better and hopefully … more

  • Automation schedule screen is not executed

    Hello everybody,

    today I want to describe interesting feature of Acumatica related to back ups of database. Imagine the following: you've restored database from back up at your dev environment. And let's say you have automation schedule that every hour you should send to each contact some emails. So, you've restored customization and would like to find the button that will block sending of all emails. At which screen it is? At none. It is interesting to know, that Acumatica already "pressed" at this button when you've restored db from back up. But for now you probably have another question. How to debug execute any schedule at all?

    I propose following steps:

    Delete all automation … more

  • How to modify default time zone at Acumatica

    Hello everybody,

    today I want to make a short notice on how to change default time zone in Acumatica. 

    In my case such need appeard when it was needed to modify default time zone of Acumatica that I've restored from database backup. In order to do this you'll need to go to screen that is named Site preferences. Id of that screen is sm200505.  more

  • Branch restriction in Automation schedule in Acumatica

    Hello everybody,

    today I want to describe one behaviour of Acumatica processing screen. 

    So, once upon a time I created processing screen. Purpose of that screen was simple: take data from some external source and insert it into Acumatica. 

    As that processing screen worked fine, it was taken a decision to create automation schedule step that will make that screen to be executed by Acumatica automatically. And then following issue arised: also that screen worked great in manual mode, it didn't work at all in Automation schedule mode at all. 

    After long investigation I found the following:

    Automation screens are executed from the user acount admin

    Also admin should have access to … more

  • How helping others can transform your life

    Here in Ukraine there is a joke: nothing spoils health of Ukrainian more then richness and welfare of his neighbor.

    Also I often hear statement that helping others can transform your life to better. I've spent some time on finding the ways to help others. But helping not via giving money. As one man once said give somebody fish for two times and for third time that person will demand fish from you. So I wanted to be a person that can give fishing rod to people instead of just giving them fish.

    As result I've decided to teach some close friends of mine programming. Well, it is not a surprise because I'm quite skillful in that area and what else can I teach? And you know, it changed my … more

  • How to measure quality of learning part 2

    Hello everybody,

    today I want to add few more notes about measuring of quality of learning, but today about tasks of classification. 

    So, one of the ways can be measuring number of wrong answers. For example with usage of the following formula:

    Imagine that your classification set has three possible labels: a (10 elements ), b ( 15 elements ), c ( 20 elements ). And let's say that your model wrongly classified 2 out of a, 3 out of b and 4 out of c. In that case following formula is applicable:

    Historically it happend that in classification tasks it is common to maximaze function, while in regression learning vice versa. 

    Another common measurement of quality of classification is … more

  • How to measure quality of learning

    Hello everybody,

    Today I want to describe some ideas about measure quality of learning. 

    First of all I want to point areas where you can apply those measurements. It can be in three areas:

    For setting funtional during learning

    For picking hyperparameters

    For evaluation of ready made model

    Another way can be combination. You can measure quality during learning with one measurement, but final model you can analyze with other measurement. 

    MSE

    So, let's start with most common formula: mean squared error:

    In words it reads the following: difference between prognozed value and desired value, squared, summed and finally averaged. 

    MSE has following featues:

    Easily minimizable … more

  • InvokeIfRequired template

    Hello everybody,

    today I want to document simple but very useful feature if you work with multiple threads in Winforms application. 

    Quite often it happens that you execute in some paralel thread long running calculations and would like time from the time notify results to UI. 

    But if you try to do this then you'll get an error that will say to you that parallel thread doesn't have permissions to some control because it didn't create such a control. So, how then update UI?

    The answer is simple, you should use method Invoke of the control. In that case everything inside of method Invoke will be executed from UI thread. 

    Needless to say that such approach is workable but to some degree … more

  • Different types of search in Acumatica

    Hello everybody,

    recently friend of mine gave me wonderful question:

    In PXSelect command, I saw Search, Search2, Search3… keywords, please explain the difference.

    Thats really good question which shows his attentiveness to details.

    So, no let's go part by part.

    Targets

    First of all, Search statement can be applied to those kinds of attributes: PXSelector, PXDbScalar and PXDefault. 

    Also you can apply Search statement to cases when you updated something in cache of Acumatica and what to reopen that part. It can look like this:

    Document.Search<POOrder.orderNbr>(currentPoOrder.OrderNbr, currentPoOrder.OrderType);

    or like this:

    [PXDefault(typeof (Search<Company.baseCuryID>))]

    Don' … more

  • Update-Database Error on switching from .Net core 1.1 to 2.0

    Hello everybody,

    today I want to share some strange behaviour that I faced. 

    Recently I needed to switch from .Net core 1.1 web app to .Net core 2.0 app. 

    I found over internet that simplest way to achieve it will be just opening project in Visual Studio 2017 and VS will switch your project by itself. I decided to give to such attempt a try. 

    Initially all went fine. Visual Studio 2017 gave me very nice looking report which convinced me that life is easy and wonderful. Actually it said that project was switched to .Net core 2.0 with success.

    Then I've tried to execute in package manager console Update-Database command. Unfortunately I've seen following error message:

    An error occurred … more