Skip to main content
Solved

How are informational/warning/error messages generated and displayed for rows in a grid


Forum|alt.badge.img

Trying to find example in C# source of a message being generated for a row in a grid, when a grid is related to an existing record. For example, when a Sales Order is selected from a list, when the order line item(s) are displayed, they may also display a message, with an ‘Informational’ icon, such as ‘Minimum Gross Profit not satisfied’. Where is an example of the C# logic that generates this message? I could not find an example in any of the tutorials?

Best answer by rdennisj57

Yes, thanks, I was, although indirectly. I was trying to flag a ‘quantity column’ with a warning message. I changed the logic to flag a ‘character’ column in the same row, and it worked.

View original

7 replies

jinin
Pro I
Forum|alt.badge.img+11
  • Pro I
  • 701 replies
  • April 19, 2022

Hi @rdennisj57 

You can write the code on the Field verifying(Grid field) the event to show the warning or error messages. RaiseExceptionHandling will help to show the warning/error message.

Example code:

protected virtual void SOLine_CuryUnitPrice_FieldVerifying(PXCache sender, PXFieldVerifyingEventArgs e)
        {
            SOLine row = e.Row as SOLine;

            if (row == null)
                return;

            if (row.IsFree != true && this.GetMinGrossProfitValidationOption(sender, row) != MinGrossProfitValidationType.None)
            {
                sender.RaiseExceptionHandling<SOLine.curyUnitPrice>(row, null, null);

//     RaiseExceptionHandling<SOLineSplit.refNoteID>(row, null, new PXSetPropertyException(Messages.POLinkedToSOCancelled, PXErrorLevel.RowWarning, row.PONbr));

}

}
 


Forum|alt.badge.img
  • Author
  • Jr Varsity II
  • 20 replies
  • April 19, 2022

Hi Jini, thank you so much for your response!  I did already try using the FieldVerifying event, but when I debug my program, this event is never executed. The program I wrote is designed as an Inquiry, so the user only DISPLAYS the grid rows. How can you make the FieldVerifying event execute when the data view rows are being loaded?


Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • 3409 replies
  • April 20, 2022

Hi @rdennisj57  Have you provide CommitChanges = TRUE at .aspx page, so that it will invoke the event when you provide the value for that field.

Also, can you please share your graph code?


Forum|alt.badge.img
  • Author
  • Jr Varsity II
  • 20 replies
  • April 20, 2022

Hi Naveen, thank you for your feedback. I changed the event handler to RowSelected, and the event handler is now executing, when the grid rows are being initially displayed to the grid. Here is the handling logic:

       protected void BOMComponentData_RowSelected(PXCache sender, PXRowSelectedEventArgs e)

        {

            BOMComponentData row = e.Row as BOMComponentData;

            if (row != null  &&

                row.ExpectedQty != null && row.TotalQtyReq != null &&

                row.ExpectedQty < row.TotalQtyReq)

            {

                sender.RaiseExceptionHandling<BOMComponentData.totalQtyReq>(

                    row,

                    row.TotalQtyReq,

                    new PXSetPropertyException(Messages.QtyExceedsExpected,

                    PXErrorLevel.Warning));

            }

        }

The RaiseExceptionHandling block IS executing when the row conditions are met, BUT no messages are being displayed to the grid row on the ASPX page.  

Here is the source for the ASPX page:

<%@ Page Language="C#" MasterPageFile="~/MasterPages/FormDetail.master" AutoEventWireup="true" ValidateRequest="false" CodeFile="AN409000.aspx.cs" Inherits="Page_AN409000" Title="Untitled Page" %>

<%@ MasterType VirtualPath="~/MasterPages/FormDetail.master" %>

<asp:Content ID="Content1" ContentPlaceHolderID="phDS" Runat="Server">

    <px:PXDataSource ID="ds" runat="server" Visible="True" Width="100%" 

        PrimaryView="invlookup" TypeName="KSIBOMExtensions.ItemAvailabilityInq">

        <CallbackCommands>

            <px:PXDSCallbackCommand Name="Insert" PostData="Self" ></px:PXDSCallbackCommand>

            <px:PXDSCallbackCommand CommitChanges="True" Name="Save" ></px:PXDSCallbackCommand>

            <px:PXDSCallbackCommand Name="First" PostData="Self" StartNewGroup="True" ></px:PXDSCallbackCommand>

            <px:PXDSCallbackCommand Name="Last" PostData="Self" ></px:PXDSCallbackCommand>

            <px:PXDSCallbackCommand Name="Cancel" ></px:PXDSCallbackCommand>

            <px:PXDSCallbackCommand Name="InventoryAllocationDetailInqMatl" Visible="False" CommitChanges="true" DependOnGrid="gridMatl" ></px:PXDSCallbackCommand>

        </CallbackCommands>

    </px:PXDataSource>

</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="phF" Runat="Server">

    <px:PXFormView ID="PXFormView1" runat="server" DataSourceID="ds" Width="100%" DataMember="invlookup"> 

        <Template>

            <px:PXLayoutRule runat="server" StartColumn="True"  LabelsWidth="S" ControlSize="S" ></px:PXLayoutRule>

            <px:PXSegmentMask CommitChanges="True" ID="edInventoryID" runat="server" DataField="InventoryID" AllowEdit="True" DisplayMode="Hint"   ></px:PXSegmentMask>

            <px:PXSegmentMask CommitChanges="True" ID="edSubItemID" runat="server" DataField="SubItemID"  AutoRefresh="true"></px:PXSegmentMask>

            <px:PXSelector CommitChanges="True" AutoRefresh="true" ID="edSiteID" runat="server" DataField="SiteID" DisplayMode="Hint" AllowEdit="True" ></px:PXSelector>

             <px:PXTextEdit ID="UOM" runat="server" DataField="UOM"></px:PXTextEdit>

            <px:PXLayoutRule runat="server" StartColumn="True"  LabelsWidth="S" ControlSize="S" ></px:PXLayoutRule>

            <px:PXNumberEdit ID="edMakeQty" CommitChanges="True"  AutoRefresh="true" runat="server" DataField="MakeQty" Width="200px" AllowEdit="True" ></px:PXNumberEdit>

            <px:PXNumberEdit ID="edQtyOnHand" runat="server" DataField="QtyOnHand" Width="200px" ></px:PXNumberEdit>

            <px:PXNumberEdit ID="edAvailableQty" runat="server" DataField="AvailableQty" Width="200px" ></px:PXNumberEdit>

            <px:PXLayoutRule runat="server" StartColumn="True"  LabelsWidth="S" ControlSize="S" ></px:PXLayoutRule>

            <px:PXDateTimeEdit CommitChanges="True" ID="edNeedDate" runat="server" DataField="NeedDate" DisplayFormat="d"></px:PXDateTimeEdit>

            <px:PXDateTimeEdit CommitChanges="True" ID="edEffectiveDate" runat="server" DataField="EffectiveDate" DisplayFormat="d"></px:PXDateTimeEdit>

            <px:PXLayoutRule runat="server" StartColumn="True"  LabelsWidth="S" ControlSize="S" ></px:PXLayoutRule>

           <px:PXDropDown CommitChanges="true" ID="ddSingleIndented" AutoRefresh="true" runat="server" DataField="SingleIndented"  ></px:PXDropDown>

            <px:PXCheckBox CommitChanges="True" ID="chkIncludePhantoms" AutoRefresh="true" runat="server" DataField="IncludePhantoms" AlignLeft="True" ></px:PXCheckBox>

            <px:PXCheckBox CommitChanges="True" ID="chkShortOnly" AutoRefresh="true" runat="server" DataField="ShortOnly" AlignLeft="True" ></px:PXCheckBox>

        </Template>

    </px:PXFormView>

</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="phG" Runat="Server">

    <px:PXGrid ID="PXGrid1" runat="server" DataSourceID="ds" Width="100%" SkinID="Inquire" SyncPosition="True" TabIndex="300" >

        <Levels>

            <px:PXGridLevel DataMember="BOMComponents" >

                <RowTemplate>

                    <px:PXSegmentMask ID="edLevel" runat="server" DataField="Level" DisplayFormat="d" ></px:PXSegmentMask>

                    <px:PXSegmentMask ID="edComponentItem" runat="server" DataField="InventoryID" DisplayFormat="d" ></px:PXSegmentMask>

                    <px:PXNumberEdit ID="edQtyOnHand" runat="server" DataField="QtyOnHand" ></px:PXNumberEdit>

                    <px:PXNumberEdit ID="edExpectedQty" runat="server" DataField="ExpectedQty" ></px:PXNumberEdit>

                    <px:PXNumberEdit ID="edRequiredQty" runat="server" DataField="RequiredQty" ></px:PXNumberEdit>

                    <px:PXSegmentMask ID="edMfgPurch" runat="server" DataField="ReplenishSource" DisplayFormat="d" ></px:PXSegmentMask>

                    <px:PXSegmentMask ID="edUOM" runat="server" DataField="UOM" DisplayFormat="d" ></px:PXSegmentMask>

                </RowTemplate>

                <Columns>

                    <px:PXGridColumn DataField="Level" Width="108px" ></px:PXGridColumn>

                    <px:PXGridColumn DataField="InventoryID" Width="120px" ></px:PXGridColumn>

                    <px:PXGridColumn DataField="QtyOnHand" Width="125px" ></px:PXGridColumn>

                    <px:PXGridColumn DataField="ExpectedQty" Width="125px" TextAlign="Right" ></px:PXGridColumn>

                    <px:PXGridColumn DataField="TotalQtyReq" Width="125px" TextAlign="Right" ></px:PXGridColumn>

                    <px:PXGridColumn DataField="ReplenishSource" Width="100px" TextAlign="Right" ></px:PXGridColumn>

                    <px:PXGridColumn DataField="UOM" Width="100px" TextAlign="Right" ></px:PXGridColumn>

                </Columns>

            </px:PXGridLevel>

        </Levels>

        <AutoSize Container="Window" Enabled="True" MinHeight="200" ></AutoSize>

        <ActionBar ActionsText="False">

                <CustomItems>

                    <px:PXToolBarButton DependOnGrid="gridMatl" Key="cmdInventoryAllocationDetailInqMatl">

                        <AutoCallBack Command="InventoryAllocationDetailInqMatl" Target="ds" ></AutoCallBack>

                    </px:PXToolBarButton>

                </CustomItems>

        </ActionBar>

        <CallbackCommands PasteCommand="PasteLine">

            <Save PostData="Container" ></Save>

        </CallbackCommands>

    </px:PXGrid>


Forum|alt.badge.img
  • Author
  • Jr Varsity II
  • 20 replies
  • April 20, 2022

Hi Naveen,

Attached is my graph source (I renamed it from .cs to .txt)

Thank you,  Randy


Chris Hackett
Community Manager
Forum|alt.badge.img
  • Acumatica Community Manager
  • 2755 replies
  • June 8, 2022

Hi @rdennisj57  were you ever able to resolve your issue? Thank you


Forum|alt.badge.img
  • Author
  • Jr Varsity II
  • 20 replies
  • Answer
  • June 8, 2022

Yes, thanks, I was, although indirectly. I was trying to flag a ‘quantity column’ with a warning message. I changed the logic to flag a ‘character’ column in the same row, and it worked.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings