Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Answered

When I enter 0 in my unit price field it's showing bksnk

Posted on by 200

Screenshot_5F00_20230511_2D00_143249_5F005F00_01.jpg

I am inserting unit price as 0 from Al code, and I want to update my subtotal value to 0, but field is showing blank, so is zero number displayed as blank?

This is code 

// Create Return Order recordNo := cdu_EnquiriesAndReturns.createSalesReturnOrder(Rec); ToSalesReturnOrder.SetRange("No.", recordNo); if ToSalesReturnOrder.FindSet() then begin ToSalesReturnOrder."Document Date" := Today; ToSalesReturnOrder.Validate("Document Date"); ToSalesReturnOrder."Posting Date" := Today; ToSalesReturnOrder.Validate("Posting Date"); ToSalesReturnOrder."VAT Reporting Date" := Today; ToSalesReturnOrder.Validate("VAT Reporting Date"); ToSalesReturnOrder."Order Date" := Today; ToSalesReturnOrder.Validate("Order Date"); // ToSalesReturnOrder."Location Code" := 'ZRETURNS'; // ToSalesReturnOrder.Validate("Location Code"); ToSalesReturnOrder.Modify(true); end; rec_EnquiriesLineA.SetRange("Document No.", Rec.No); if rec_EnquiriesLineA.FindSet() then begin repeat rec_SalesLinesA.SetRange("Document No.", recordNo); rec_SalesLinesA.SetRange("Document Type", enum_DocumentType::"Return Order"); //rec_SalesLinesA.SetRange("Line No.", rec_EnquiriesLineA."Line No."); if rec_SalesLinesA.FindSet() then begin rec_SalesLinesA.Quantity := rec_EnquiriesLineA."Return/Replace"; rec_SalesLinesA.Validate(Quantity); rec_SalesLinesA."Return Qty. to Receive" := rec_EnquiriesLineA."Return/Replace"; rec_SalesLinesA.Validate("Return Qty. to Receive"); rec_SalesLinesA."Return Reason Code" := rec_EnquiriesLineA."Return Reason Code"; rec_SalesLinesA.Validate("Return Reason Code"); exitvalue := rec_SalesLinesA."Total Returned"; total := rec_EnquiriesLineA."Return/Replace"; rec_SalesLinesA."Unit Price" := 0.00; rec_SalesLinesA.Validate("Unit Price"); rec_SalesLinesA.Modify(true); rec_SalesLineRetuurned.SetRange("Document No.", recordNo); rec_SalesLineRetuurned.SetRange("Document Type", enum_DocumentType::"Return Order"); rec_SalesLineRetuurned.SetRange("Line No.", rec_EnquiriesLineA."Line No."); if rec_SalesLineRetuurned.FindFirst() then begin exitvalue := rec_SalesLineRetuurned."Total Returned"; rec_SalesLineRetuurned."Total Returned" := exitvalue + total; rec_SalesLineRetuurned.Modify(true); end;

  • Verified answer
    Govinda Kumar Profile Picture
    Govinda Kumar 2,203 Super User 2024 Season 1 on at
    RE: When I enter 0 in my unit price field it's showing bksnk

    Hi,

    I'm sorry but your code is not readable, as you said you are inserting a value of 0 from code and want to update the subtotal value accordingly. By default, I think the subtotal value is a multiple of the quantity, unit price and sum of all line amount, and when the unit price is blank it is considered as 0. This is because of the 'BlankZero' property that is set to true in the Sales Order Subform page.

    pastedimage1683798220392v1.png

    To display the value '0' on the Sales Order Subform page, you can set the BlankZero property to false.. you can do it using a page extension..

    pageextension 50126 "Sales Order Subform Ext" extends "Sales Order Subform"
    {
        layout
        {
            modify("Unit Price")
            {
                BlankZero = false;
            }
        }
    }

    Hope this helps

    Regards

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans