How to extract Right 3 characters of a Ledger Name?

Discussion in 'Tally Developer' started by ABDUL AZIZ, Jul 17, 2019.

    
  1. ABDUL AZIZ

    ABDUL AZIZ Member


    Dear Experts,

    Please help me to get the last 3 characters of a Ledger Name in TDL ... Like we do in excel =Right("Ledger",3).

    For Example:

    Ledger Name: "ABC India Ltd"
    I want to exctract last three letters: "Ltd"


    Thanks & Regard,
     


  2. Jay kumar tailor

    Jay kumar tailor Well-Known Member


    See TDS Button For This.
     


  3. ABDUL AZIZ

    ABDUL AZIZ Member


    Sir where is TDS Button?
     


  4. Bipin Damania

    Bipin Damania Active Member


    By using Filter, you will get the same, without any TDL.
     


  5. balajimg

    balajimg Active Member


    use $$StringLength & $$StringPart
     


  6. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    [System : Formula]
    TotalLength : $$stringLength: $LedgerName ;;..... This gives you length of your String.
    StrBegin : @@TOtalLength - 3

    StrExtract : $$StringPart:$LedgerName:mad:@StrBegin:3
     
    ABDUL AZIZ likes this.


  7. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    Ha Ha... we read each other's mind.....at same time .... :):cool:
     


  8. ABDUL AZIZ

    ABDUL AZIZ Member


    Sir, My formula is like as given below:
    $LedgerName = ##ListOfLedgerAll

    Once the user selects a ledger then above variable stores that,

    Now what is want is that
    1. there are many ledgers which contains some part of the selected ledgers like "ABC Ltd - LUK"
    2. I want to display all the entries from all those ledgers which contains the last three characters of the selected ledger, as in the given case "LUK"

    Thus I want to extract the last three characters "LUK" and use in formula.
    Like this:

    $LedgerName Contains Right(##ListOfLedgerAll ,3)
     


  9. balajimg

    balajimg Active Member


    True :)
     


  10. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    $LedgerName Contains"LUK"

    However it is better that a Variable be used instead of "LUK"..... you will need a field wherein a user enters the characters "LUK", this field will modify a variable e.g. ledname

    and hence above formula to be revised as $LedgerName Contains $$String:##ledname
     


  11. ABDUL AZIZ

    ABDUL AZIZ Member


    Sir, same way i have don, I was just illustrating..
     


  12. ABDUL AZIZ

    ABDUL AZIZ Member


    Sir,

    It is showing mad here

    StrExtract : $$StringPart:$LedgerName:mad:mad:StrBegin:3

    mad to be replaced by what?
     


  13. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    Code:
    StrExtract : $$StringPart:$LedgerName:@@StrBegin:3
     


  14. drive

    drive Active Member


    Use : Function Like This

    [Function: Fc_Left]
    Parameter: StrValue : String
    Parameter: NoOfChar : Number
    Variable: vTmp : String
    Return: String
    00 : If: Not ($$IsEmpty:##StrValue) And Not ($$IsEmpty:##NoOfChar)
    10 : Set: vTmp : $$StringPart:##StrValue:0:##NoOfChar
    20 : End If
    30 : Return: ##vTmp

    [Function: Fc_Right]
    Parameter: StrValue : String
    Parameter: NoOfChar : Number
    Variable: vTmp : String
    Variable: vStarting : Number
    Return: String
    00 : If: Not ($$IsEmpty:##StrValue) And Not ($$IsEmpty:##NoOfChar)
    02 : Set: vStarting : $$StringLength:##StrValue
    04 : If: ##vStarting => ##NoOfChar
    06 : Set : vStarting : ##vStarting - ##NoOfChar
    08 : Else
    10 : Set : vStarting : 0
    12 : End if
    14 : Set: vTmp : $$StringPart:##StrValue:##vStarting:##NoOfChar
    20 : End If
    30 : Return: ##vTmp




    Sample :

    [System: Events]
    MrDrive : Load Company: Yes : Call: Fc_Main

    [Function: Fc_Main]
    Variable: vMainStr : String: "Mr Drive Tally Developer"
    Variable: vTmp : String
    001 : Set : vTmp : $$Fc_Left:##vMainStr:5
    002 : Msg Box: "MSG Box" : ##vTmp
    003 : Set : vTmp : $$Fc_Right:##vMainStr:5
    004 : Msg Box: "MSG Box" : ##vTmp
     
    Vikash_Dhamecha and ABDUL AZIZ like this.


  15. ABDUL AZIZ

    ABDUL AZIZ Member


    Thanks you very much to all the experts.

    Finally target achieved.

    Thanks a lot.....

    Amit Sir you are simply Genius.
     


  16. ABDUL AZIZ

    ABDUL AZIZ Member


    Nice! Thanks a lot!
     


  17. ABDUL AZIZ

    ABDUL AZIZ Member


    Can we set the format of an amount filed like...
    Local : Field : AllFranchiseeInvoicesVchrAmount : Set As : $$Total:AllFranchiseeInvoicesVchrAmount
    Local : Field : AllFranchiseeInvoicesVchrAmount : Format : "DrCr"

    It is not happening please help..
     


  18. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    Local : Field : AllFranchiseeInvoicesVchrAmount : Set As : $$Total:AllFranchiseeInvoicesVchrAmount
    Local : Field : AllFranchiseeInvoicesVchrAmount : Format : "DrCr"
    Local : Field : AllFranchiseeInvoicesVchrAmount : Use : Amount Field

    The Dr/Cr will appear, depends on what your Field AllFranchiseeInvoicesVchrAmount collects.
     


  19. ABDUL AZIZ

    ABDUL AZIZ Member


    Done Sir,

    Thanks!

    Local : Field : AllFranchiseeInvoicesVchrAmount : Set As : $$Total:AllFranchiseeInvoicesVchrAmount
    Local : Field : AllFranchiseeInvoicesVchrAmount : Type : Amount
    Local : Field : AllFranchiseeInvoicesVchrAmount : Use : Amount Field
    Local : Field : AllFranchiseeInvoicesVchrAmount : Format : "DrCr"
     


  20. ABDUL AZIZ

    ABDUL AZIZ Member


    How to remove decimals like 1000.00, I want only 1000
     


  21. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    You should not be asking too many basic questions......these are simple things...... more you ask, less you will learn.

    So i advise you to seek your answer in the TDE..... and learn R&D techniques and answers to simple questions.
     


  22. ABDUL AZIZ

    ABDUL AZIZ Member


    Done Sir!

    Format : "DrCr, Decimal:0"
     


  23. ABDUL AZIZ

    ABDUL AZIZ Member


    Sir, Is it possible to show in the below local field Dr. Total and Credit Total and Net Total separately using below code? in three line:

    Local : Field : AllFranchiseeInvoicesVchrAmount : Set As : $$Total:AllFranchiseeInvoicesVchrAmount
     


  24. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    If you want 3 lines, then make 3 lines....If you want 3 fields, make 3 fields....

    In respective line/field .... give condition.... $$IfDr:<amount> then <Amount> Else 0 .... (here replace amount with your UDF value)
    Same do for Credit amount...... as for the Nett amount, I presume you know the formula, by now.
     


  25. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    Very good... now do it for Dr/Cr and Nett amount........... good luck.
     


Share This Page