Grids Master-Detail Relationship

Hi Everyone, Sometimes you need to have a screen with 2 grids that depend on each other. When you change line in one grid, it should refresh records in another. In this case you need to establish Grids Master-Detail relationship. In general master-detail relationship for grids is almost the same as for form-grid. You can read more about it in T200 Framework Fundamentials Training Guide, Example 2.2, Setting Up the Master-Detail Relationship Between DataAs a summary from the training, we need to do 3 points Put PXDBDefault attributes in child DAC to auto-initialize dependent keys. Put PXParent attribute in child DAC to allow cascade deletion and few other functions. Use… Read more

Primary & Foreign Keys

Hi Everyone, Acumatica is a advanced ERP system. And when we speak about ERP it is not only about data input, it also about how to store, retrieve and analyze data we have. Because of this we have very connected tables in Acumatica databas where almost every 3rd-4th column is a foreign key to other record. This helps a lot with data analyses.But how to organize keys better for usage, faster for search and smaller for database storage? Primary/Foreign Keys Definition In general we have only 2 ways to define and organize keys: Natural Keys and Surrogate Keys. Each way has own benefits. Natural keys (Code, CD)A natural key is… Read more

Concurrent Update

HI All, With current web applications architecture it is complicated to track what users are doing on browser side: are they still online or on the way to take a cup of coffee? Will they save a record or just checking it?We can’t just lock records in the Web Application every time when someone have opened it for editing.So here we have 2 main problems: You don’t know who and when will save it You don’t know if user still online or not In Acumatica we have designed the platform in the way to not depend on user behavior. But we still have 2 different ways to manage concurrent update… Read more

Dynamic Drop-Down Control

Hi Everyone, Usually Acumatica Drop-Down controls have fixed lists of values. Of course you can use PXStringListAttribute.SetList<…>(…) method do change list of values dynamically, but how to make it more handy. The way I recommend you is to create an attribute that can encapsulate all the field related logic, so to use it you can just put the attribute on the proper place. So the plan: Create an attribute that will be inherited from PXStringList and provide the values Create IPrefetchable class that can be automatically load all possible list from DB and cache it. In the same time Acumatica will auto-reset when the linked table is changed. This is… Read more

In-Screen Popup Panels with iFrame

Hi Everyone, Most probably you have seen the function in Acumatica where you can open a new screen in a iframe on top of the existing screen without navigation. This approach has some benifits and disadvantages. Have inplace pupup helps to have less redirection and less windows, but in the same time it blocks the previous page and you cant modify/see background untill you close the popup. Choose the way you use wisely based on the requiranments and design you have. How to call inline popup? public PXAction<SOOrder> createPrepayment; [PXUIField(DisplayName = “Create Prepayment”, MapViewRights = PXCacheRights.Select, MapEnableRights = PXCacheRights.Update)] [PXButton(ImageKey = PX.Web.UI.Sprite.Main.AddNew)] protected virtual void CreatePrepayment() { ARPaymentEntry target =… Read more

Selecting data though Acumatica PXSelectorAttribute

Hi everyone, Today, I would like to share with you small tip to work with PXSelectorAttribute base on my experiences. Here is the story, let me image that you have the DAC and you want to add more information which is just supporting information and you dont want to save it. Please take a look on my DAC bellow. And now I would like to get the value of Default Price to display after I choose the Inventory Item. I will create code in the in the FieldUpdatedEvent like bellow In the conclusion, depends on your scenario you can use PXSelectorAttribute to get data from the cache. It would be… Read more

Select Multiple Documents into One Grid

Hi Everyone, In some situations you may want to show different unconnected documents inside one grid. Just for example you want to create Customer Overview screen and show all Invoices, Payments and Sales Orders together in one place. Join tables together is not the best approach, as you will have to add different columns with same names for fields from different tables. Better Approach is select them independently in Data View delegate and merge them into one virtual DAC. So plan is the following: Create a new Virtual DAC that will represent any document in the system. Please note that this DAC should have a Key that should unique even… Read more

Context Parameters

Hi Everyone, In this topic I want to cover another architecture pattern we have in Acumatica – Usage of context related parameters. Problem Statement Within the event model it is not easy to pass parameters into the other child or related events. There is a way with local variables how it is shown in T300 Training Guide and Override Release Action Lesson. However it is a really not nice approach if events happens in different objects like here: public class SomeGraph : PXGraph<SomeGraph> { public void CreateBatch() { bool needValidate = true; //Create Batch } } public class JournalEntry : PXGraph<JournalEntry> { public void DAC_RowUpdated(PXCache cache, PXRowUpdatedEventArgs) { if (needValidate) { … } } } Solution In Acumatica we use an approach that we call Scopes. Scope is a class that set… Read more

Generic Events Declaration

Hi Everyone, Starting from Acumatica 2017 R2 you may notice a different events declaration. We call in generic events or new events declaration. Here you can see an example for row and : protected virtual void _(Events.FieldUpdated<DAC, DAC.field> e) {} protected virtual void _(Events.FieldDefaulting<DAC, DAC.field> e) {} protected virtual void _(Events.RowUpdated e) {} protected virtual void _(Events.RowSelected e) {} protected void _(Events.CacheAttached e) {} From the functional side there is not difference between old and new events declarations. However with generic events you have 2 main benifits: No more mistakes in names of DACs or Fields. As you rerefence it by tipe whong name won’t be even compiled. Don’t need to cast DACs anymore from e.Row anymore. It will have a typeinside. PXCache cache = e.Cache; DAC row = e.Row; However there are a couple of… Read more

Acumatica 6-tiers Web Architecture

Hi All, Recently got a question about Acumatica web architecture and tires. To answer it I have prepared slide that I would like to share with you now: Acumatica 6-tiers Web Architecture: Acumatica Cloud xRP Platform (Presentation, Business and Data Access tiers): The basic diagram of Acumatica SaaS hosting Have a nice development!

Resort grid rows with Drag and Drop

Hi Everyone, In Acumatica 2018R1 we have a new cool feature to drag and drops rows of the grid to resort them. As you can see sorting is still based on database column (In my case it is Sort Order) but Acumatica can automatically reorder all rows based position you dropped it. This is just a first version so still have some limitations (like it is still not fully works with extensions for existing DACs), but I really like we can  bring new and very friendly user experience to ERP. How to implement it in own code? To have this feature you need to change several things in your Graph,… Read more

PXSelector and DirtyRead

Hi Everyone, Want to speak today about Dirty Read property of selector. Base explanation you can find in Acumatica API reference. How ever this one is very basic, so let me try to share with you real case. You may know about Readonly vs Merged data retrial from DataView. Basically if you use PXSelectReadonly data-view it will always return data only stored in database. If you use standard data-view like PXSelect Acumatica will get data from DB and than merge it with unsaved data from cache. This is fully applicable for data-views (PXSelect, PXSelectReadonly) and selectors as well. When you define PXSelectorAttribute than it will be always read-only by default.… Read more

Multi – Line Text Edit 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… Read more

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

Custom Image on Acumatica Form

Hi All, Want to share with you way how can you add Сustom Image on Acumatica form. To do that you can use PXImage control. In the ImageUrl you can add physical path to image on the file system. <px:PXImage runat=”server” ImageUrl =”~/Icons/login_logo.png”  /> This is static image and not linked with any data view or dac, so if you need to change images dynamically you have to write logic in the code behind file however it is not recommended way by Acumatica standards. Have a nice development!

Show and Hide Grids on the Fly

Hi Everyone, Sometimes you need to show user interface differently depend on parameters selected. Here I want to show you an approach where you can show different grids depend on parameters selected in filter. You may need different grids in the following cases: If have different data access classes (tables) to show. If you need to have different grids layout depend on parameters. If you  need to to have different columns configurations. So the plan is the following: Have 2 different DACs. We need it to have different caches, as viability settings are linked to cache. public class DetailsTableA : IBqlTable {       public abstract class fieldA: IBqlField { }         [PXDBString(1)]       [PXUIField(DisplayName = “Field A”)]    … Read more

Multi-Select Selector

Hi There, Want to share with you hidden way to add a multi-select Selector control to have better filters. There is a special UI Control px:PXMultiSelector that allows you to select multiple values in the same field. Values will be stored in the field with Semicolon Separator. For example in the field like shown above we will have following value: ACTUAL; BUDGET To add such control you need to do following: Define a selector on the DAC field. Please note that you should disable Validate value, as selector will try to search combined value in DB and fails with error. [PXSelector(typeof(Ledger.ledgerCD), ValidateValue = false)] Second step will be UI control definition.… Read more

Generate IN Receipt from the Code

Hi All, In my experience I have quite a lot of questions like – how to create a document on the fly. The answer is rather simple – we need to use the same objects as user interface and emulate user interface behavior. As the main object that contains a business logic and validation is Grpah, we need to create it from the code and use for calling actions and pushing data. INReceiptEntry graph = PXGraph.CreateInstance<INReceiptEntry>() To create a new object we can use PXCache. INRegister header = (INRegister)graph.CurrentDocument.Cache.CreateInstance(); Every container control form UI is linked with Data View that is linked with DACs and tables. As you may know… Read more

SQL In <> Operator in BQL

Hi There, Today want to show you example of amazing and very new BQL Operator – In<>. This operator was added just recently with Acumatica version 2017R2, so now you can pass there an array of values and Acumatica core will convert it to SQL IN ( … ) statement. Here is a code example: Object[] values = new String[] { “AC”, “IN” }; InventoryItem item = PXSelect<InventoryItem,        Where<InventoryItem.itemStatus, In<Required<InventoryItem.itemStatus>>>>.Select(Base, values); Console.WriteLine(item.Descr); This will be converted to following SQL Select * from InventoryItem InventoryItem Where InventoryItem.Status In (‘AC’, ‘IN’) Order by InventoryItem.InventoryCD Please note that In<> operator is available only with Required<> parameter and you need to pass array of possible values manually to Select(…) method parameters. Have… Read more