Help needed for if condition

Discussion in 'Free Source Codes' started by panam, Jun 18, 2021.

    
  1. panam

    panam Member


    Dear sir,

    help required in field. if the stock item does not have HSN code we should get "N/A" .
    by default i am getting "not found" when hsn is not given.

    [Field:invhsnum]
    Use : Name Field
    ;Set as:$GSTHSNCode:StockItem:$StockItemName

    Set as:if $$isempty:$GSTHSNCode:StockItem:$StockItemName then $$LocaleString:"N/A" ELSE $$LocaleString:$GSTHSNCode:StockItem:$StockItemName
    Align :right;Center
    Skip : Yes
    Width:10
    Set Always: Yes
     


  2. Himanshu-2002

    Himanshu-2002 Active Member


    Try to Do it Like This
    Code:
    [Field:HSNCode]
    Use:Name Field
    Set As:$_HSNCode:StockItem:$StockItemName
    Set By Condition:($$IsEmpty:$$Value):"N/A"
     
    panam likes this.


  3. panam

    panam Member


    Thank u Himanshu bhai for the reply and help. but still the code is not working.
     


  4. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    [Field: HSNCode]
    Use : Name Field
    Set as : If $$IsEmpty:mad:@HSNCode Then "N/A." Else @@HSNCode
    Set Always : Yes
    Skip : Yes
    Align : Centre
    Width : 8
    Invisible : NOT @@IsSales

    [System : Formula]
    HSNCode : $$GetGSTTransInfo:$Date:$GSTEntryLedgerName:$StockItemName:"HSNCode"
     
    panam likes this.


  5. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    Capture.PNG
     
    panam likes this.


  6. panam

    panam Member


    Dear sir,
    the code is working fine only while generating new vouchers but not working in saved vouchers.
    Thank u Amit sir for the help.
     


  7. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    The photo above is a SAVED voucher.
     
    panam likes this.


  8. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    If still not working....then use SET AS --- as given by Himanshu. it will work too.
     
    panam likes this.


  9. panam

    panam Member


    s
    sir, after saving the voucher and again in alteration mode, the hsn is not displayed for any items.
     


  10. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    [Field: HSNCodeNew]
    Use : Name Field
    Set as : If $$IsEmpty:mad:@HSNCodeNew Then "N/A" Else @@HSNCodeNew
    Set Always : Yes
    Skip : Yes
    Align : Centre
    Width : 8
    Invisible : NOT @@IsSales
    [System : Formula]
    HSNCodeNew : $_HSNCode:StockItem:$StockItemName

    It is working for me...........incorporate the changes as above.
     
    panam likes this.


  11. panam

    panam Member


    sir,
    the error was in the emoji code.

    Set as : If $$IsEmpty:mad:@HSNCodeNew Then "N/A" Else @@HSNCodeNew

    Set as : If $$IsEmpty@@HSNCodeNew Then "N/A" Else @@HSNCodeNew


    [​IMG]
    [​IMG]
     
    Last edited: Jun 19, 2021


  12. panam

    panam Member


    dear Amit sir, This is working fine in one company which is newly created in april2021 but not working for other company which is 4 years old. i just given hsn tax rate and hsn code for exsiting items in old company. in old company newly created stock item the code is working correctly.
    what might be the problem i dont know. please identify the error.

    [Field: HSNCode]
    Use : Name Field
    Set as : If $$IsEmpty:mad:@HSNCode Then "N/A." Else @@HSNCode
    Set Always : Yes
    Skip : Yes
    Align : Centre
    Width : 8
    Invisible : NOT @@IsSales

    [System : Formula]
    HSNCode : $$GetGSTTransInfo:$Date:$GSTEntryLedgerName:$StockItemName:"HSNCode"
     


  13. panam

    panam Member


    sir, this code is not working for me.
     


  14. panam

    panam Member


    sir,
    i modified Himanshu bhai code .now it is working fine in new company and also in old company

    [Field:HSNCodenew]
    Use:Name Field
    Set As:$gstHSNCode:StockItem:$StockItemName
    Set By Condition:($$IsEmpty:$gstHSNCode:StockItem:$StockItemName):"N/A"
    Set By Condition:($$IsEmpty:$GSTIGSTRate:StockItem:$StockItemName):"N/A"
    Set Always : Yes
    Skip : Yes
    Align : Centre
    Width : 8
     
    Amit Kamdar likes this.


  15. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    very good....enjoy......... :p
     
    panam likes this.


  16. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    Maybe...this code does not like OLDIES..........
     
    panam likes this.


  17. panam

    panam Member


    Thank u Himanshu bhai for the code. your syntax helped to solve my query.
    Also special Thanks u Amit sir for uninterrupted support and guidance.
    Amit sir syntax also helped me to learn the logic and understand that result can be achieved in very ways.
     


  18. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    Sometimes, depends on DATA and Company features enabled/disabled...... there are various methods to get results.
     


  19. panam

    panam Member


    dear sir,
    help needed in this code. here i am taking hsn rate of tax in my UDF . if my stock item has no hsn rate then it should be blank or N/A.
    as hsn rate is using number field, we are getting as "0%" for stock item which has no hsn rate.
    i tried use:name field instead of number field. it is working fine but % symbol will not come with it.
    also another problem stock item with "0%"(zero) will not be be displayed if we use name field.

    please suggest some solution for this?

    [Field:hsnrat1]
    Use: number field
    Set as:$GSTIGSTRate:StockItem:$StockItemName
    set By Condition:($$IsEmpty:$GSTIGSTRate:StockItem:$StockItemName):" "
    Format: "no comma, percentage"
    Width: 5
    Style: NORMAL BOLD
    Align : Center
    Skip : YES
    Set Always: Yes
     
    Last edited: Jun 19, 2021


  20. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    Understand the Basic.........if using Name Field, then do not expect a % symbol.

    However, you can achieve the same with a $$String or $$LocaleString ........... but do it and try it....on your own....

    Such simple things you can do now........
     
    panam likes this.


  21. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    If you are expecting to be spoonfed ready solutions, then you will not learn........It might take hours or days for you, but you need to do it on your own. It is easily doable.
     
    panam likes this.


  22. Himanshu-2002

    Himanshu-2002 Active Member


    Your Welcome Sir, As Amit sir suggested.. You really need to understand why some methods are not working for you but working for us... I'll suggest to learn Tally XML Schema to understand it completely....
     
    panam likes this.


  23. panam

    panam Member


    himanshu bhai please suggest any link or video for learning Tally XML schema.
     


  24. Himanshu-2002

    Himanshu-2002 Active Member


    Sir you can follow this YT Channel, sooner he will be uploading video on tally schema

    https://youtube.com/playlist?list=PLY9SvfhJqe-fP5fHfmeWmtG2QLTut0SYR

    Teja Sir Video on Reading XML:-


    .. After watching these you can export a voucher in xml and compare that xml with voucher in tally... And you will find that method name and xml tag is same...
     
    Sanjeev S and panam like this.


  25. panam

    panam Member


    Thank u very much Himanshu bhai.
     


Share This Page