Help -: replacing 0 by - in a filed

Discussion in 'Free Source Codes' started by Sadia sharma, Apr 24, 2021.

    
  1. Sadia sharma

    Sadia sharma New Member


    how can i print "-" in place of zero in below field, so whenever value will be zero it will print dash, currently it is printing 0% if value is nil but i want to print -

    Code:
    [Field: POS RateofDuty]
       Use       : Number Field
       Set As     : $TVATSTKIVatRate:StockItem:$StockItemName
       Format     : "Zero,Percentage"
       Width     : 20% Page
     


  2. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    Set As : If $$IsEmpty:$TVATSTKIVatRate:StockItem:$StockItemName then $$String:"-" Else $TVATSTKIVatRate:StockItem:$StockItemName
     
    Sadia sharma likes this.


  3. Sadia sharma

    Sadia sharma New Member


    Sir, thanks for the reply, the condition provided by you looks perfect but it's not working please see image[​IMG] -

    in first image using old code Tax% is coming

    but in 2nd part of image after using below code Tax % is coming only 0%, please help

    Code:
    [Field: POS RateofDuty]
        Use            : Number Field
        Set As        : if $$IsEmpty:$TVATSTKIVatRate:StockItem:$StockItemName then $$String:"-" Else $TVATSTKIVatRate:StockItem:$StockItemName
        Width        : 20% Page
        Format        : "Zero,Percentage"
        Align        : Center
    
     

    Attached Files:

    Last edited: Apr 24, 2021


  4. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    If it is coming as `0' then it has nothing to do with the above formula......... it would have come as `-'.

    Check your UDF again for any spell mistake or anything.

    Also instead of $StockItemName .......... try #FieldName (the Field where your StockItem name is displayed)
     
    Sadia sharma likes this.


  5. Sadia sharma

    Sadia sharma New Member


    Sir
    I tried, i don't know why its not working, can i do something separately to change 0% of this field in to -, please help
     


  6. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    Remove this line and see..........
    Use : Number Field
     
    Sadia sharma likes this.


  7. Sadia sharma

    Sadia sharma New Member


    Thanks for the reply, after removing Use : Number Field, it is working and showing "-" but it's not showing percentage sign (please see image)

    this is after using below code
    Code:
    [Field: POS RateofDuty]
    Set As         : If $$IsEmpty:    $TVATSTKIVatRate:StockItem:$StockItemName then $$String:"-" Else $TVATSTKIVatRate:StockItem:$StockItemName 
    Width        : 20% Page
    Format        : "No Zero, Percentage"
    Align        : Center
     

    Attached Files:



  8. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    [Field: POS RateofDuty]
    Set As : If $$IsEmpty: $TVATSTKIVatRate:StockItem:$StockItemName then "-" Else $TVATSTKIVatRate:StockItem:$StockItemName + "%"
    Width : 20% Page
    Align : Center
     
    Sadia sharma likes this.


  9. Sadia sharma

    Sadia sharma New Member


    Thanks for the reply, it is showing bad formula error after using this, please see image
     

    Attached Files:



  10. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    $$String:$TVATSTKIVatRate:StockItem:$StockItemName + $$String:"%"
     
    Sadia sharma likes this.


  11. Sadia sharma

    Sadia sharma New Member


    Dear sir, thanks for the reply

    after using this, - sign is coming if field and % sign is also coming but 0% is coming every time even if there is 5%
     


  12. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    SHOW screenshots....
     


  13. Sanjeev S

    Sanjeev S Active Member


    One more option can be add another field with string in nature and use it for printing and make the actual calculation fields invisible
     


Share This Page