In a Report, can we display zero in the Amount Field, if the value is empty?

Discussion in 'Knowledge Base' started by admin, May 17, 2013.

         
  1. admin

    admin Administrator Staff Member


    Query:
    In a Report, can we display zero in the Amount Field, if the value is empty?

    Solution:
    Currently, Amount Fields allow setting only non-zero values.
    In order to force zero onto fields bearing empty values, the Type of the Field must be changed to either String or Number optionally (if the value is zero) and Zero can be set in the Field.
    If the Field Type is set to Number, the Attribute Format must be set to Zero.
    Example:
    Following code sets zero in Debit and Credit Fields that are Empty within the default Trial Balance Report:
    [#Field: DSPClDrAmtA]

    Option : DSPClDrAmtA Number : $$IsEmpty:mad:FldValue

    [!Field: DSPClDrAmtA Number]

    Inactive : No
    Type : Number
    Format : "Zero"

    [#Field: DSPClCrAmtA]

    Option : DSPClDrAmtA Number : $$IsEmpty:mad:FldValue
     




  2. thanks sir
    i try this logic to qty field
    but not work

    how can it display 0 qty when my field is empty ?

    pl help
     



  3. admin

    admin Administrator Staff Member


    Share your code here:)
     




  4. [#Menu:gateway of tally]
    Add:Item:BPR stock : Alter:bprreport


    [Report:bprreport]
    Form:bprreport
    Variable:svtodate
    MultiObjects:mystkcoll
    [Form:bprreport]
    Part:bprheading,bprreport
    Button:exportbutton
    [Part:bprheading]
    Lines:cmpnm,rpthead

    [Line:cmpnm]
    Field:medium prompt,name field
    Local:Field:medium prompt:Info:"BPR Report For "
    Local:Field:name field:Info:##SVCurrentCompany
    [Line:rpthead]
    Field:medium prompt,name field
    Local:Field:medium prompt:Info:"As on date "
    Local:Field:name field:Info:##svtodate
    [Part:bprreport]
    Line:bprtitle,bprline
    Repeat:bprline:mystkcoll
    Scroll:Vertical
    Common Border:Yes

    [Line:bprtitle]
    Use:bprline
    Local:Field:default:Type:String
    Local:Field:default:Color:BLUE

    Local:Field:default:Lines:2
    Local:Field:srno:Info:"Sr. No."
    Local:Field:srno:Full Width:No
    Local:Field:itemnm:Info:"Item Name"
    Local:Field:itemgrp:Info:"group Name"
    Local:Field:erpclosing:Info:"ERP Stock"
    Local:Field:buffstock:Info:"BUFFER (Final Norm)"
    Local:Field:eek:kstock:Info:"Ok Stock (On Hand Stock)"
    Local:Field:dispqty:Info:"Disp. Clearance to Foundry"
    Local:Field:extrareq:set as:"Extra Requirment"
    Local:Field:bprcolor:Info:"BPR Color Code"
    Local:Field:bprcolor:Delete:Background
    Local:Field:extrareq:Delete:Storage
    Local:Field:extrareq:Type:String
    Border: thin top bottom
    Delete:Remove if
    [Line:bprline]
    Field:srno,itemnm,itemgrp,erpclosing,buffstock,okstock,bprcolor,dispqty,extrareq
    Remove if: $$IsEmpty:$bufferstock:stockitem:$stockitemname
    Selectable: No

    [Field:srno]
    ;Use: short name field
    Set as:$$Line
    Skip:Yes
    Full Width:No
    [Field:itemnm]
    Use: name field
    Set as:$stockitemname
    Skip:Yes
    Full Width:Yes
    [Field:itemgrp]
    Use: name field
    Set as:$parent
    Skip:Yes
    Full Width:Yes
    [Field:erpclosing]
    Use: name field
    Set as:$closingbalance
    ;Set as: $$ToValue:##svtodate:$closingbalance
    Align:Right
    Skip:Yes
    Full Width:No
    [Field:buffstock]
    Use: qty field
    Set as:$bufferstock:stockitem:$stockitemname
    Skip:Yes

    [Field:bprcolor]
    Use: short name field
    Set as:""
    Width: 5
    Skip:Yes
    Background:mad:mybprcolorcode
    formulaa: (#okstock * 100) / #buffstock
    mybprcolorcode:if @formulaa = 0 then "Black" else if @formulaa < 33 then "red" else if @formulaa > 34 and @formulaa < 66 then "yellow" else if @formulaa > 67 and @formulaa < 99 then "green" else "white"
    Full Width:No

    [Field:eek:kstock]
    Use: qty field
    Set as:$$FilterQtyTotal:pendingBatches1:myokstock:$closingbalance
    Skip:Yes
    [Field:dispqty]
    Use:qty field
    Align:Right
    Set as: $$AsQty:mad:notzero
    notzero: if @otherthanrej <= 0 then 0 else $$AsQty:mad:otherthanrej
    otherthanrej:#buffstock - #okstock + @myextraqt
    myextraqt : if #extrareq < = 0 then 0 else #extrareq
    Skip:Yes
    Full Width:No
    Set Always:Yes
    [Field:extrareq]
    Use:qty field
    ;Set as:$extraq:stockitem:$stockitemname
    Set as:if $extraq < = 0 then $$AsQty:0 else $$AsQty:$extraq
    Storage:extraq
    Format : "Symbol, Short Form, No Compact"
    Full Width:No

    [Collection:mystkcoll]
    Type:stock item
    Fetch:stockitemname,closingbalance,name,extraq
    Sort:Default:$parent

    [System:Formulae]
    myokstock:mad:@a1 and @@a2 and @@a3
    a1: $GodownName not contains "MR"
    a2:$GodownName not contains "CR"
    a3:$GodownName not contains "UD"



    [#Form:stockitem]
    Add:part:After:STKI Basic:bprdetails

    [Part:bprdetails]
    Line:bprdetails,extraqty
    [Line:bprdetails]
    Field:medium prompt,bpr qty field
    Local:Field:medium prompt:Info:"Buffer Stock"

    [Field:bpr qty field]
    Use: qty field
    Set as:$bufferstock
    Storage:bufferstock
    [Line:extraqty]
    Fields:medium prompt,extraq
    Local:Field:medium prompt:Info:"Extra Requirment"
    [Field:extraq]
    Use:qty field
    Format : "Symbol, Short Form, No Compact"
    Storage:extraq




    [System:UDF]
    bufferstock:Quantity:3800
    extraq:Quantity:3900



    [#Part: STQ Batch Details]

    Lines : STQ BatchIntro, STQ Godown Titles, STQ Godown Details
    BottomLines : STQ BatchTotals
    Repeat : STQ Godown Details : Pending Batches
    Total : STQGodownQty
    Scroll : Vertical
    Width : 50% Page
    Page Break : DSP ContLine, DSP STQBatchOpBreak

    [Collection: Pending Batches1]

    Type : Batch
    ;Child of : ##StockItemName
    Child Of:#itemnm
    Compute : GodownName : $GodownName
    Compute : BatchName : $BatchName
    Compute : ClosingBalance: $ClosingBalance
     



Share This Page