Want to import Ledger with 2 or more Allias

Discussion in 'Tally Developer' started by sattam, Mar 16, 2024.

    
  1. sattam

    sattam Active Member


    Dear Experts Please Help
    When I import ledger with 2 or 3 Allias its imported successfully but problem is in bellow img

    Led1.png

    Code:
    ;;;;Part of code
    125  :    New Object : Ledger
    
       126  :    Set Value  : Name  : $Name
       127  :    Set Value  : Parent  : $$ReportObject:$$CollectionFieldByKey:$Parent:$Name:SmpGroupLedgers
    
    
    
       C09  :    INSERT COLLECTION OBJECT : Name
       C10   :   Set Target : Name
       C11 :    If:NOT $$isempty:##SKCLedAlias1
       C12 :   SET VALUE   : Name :##SKCLedAlias1
       C13 :    END IF
       C14   :    Set Target:..
    
       C15  :    INSERT COLLECTION OBJECT : Name
       C16   :   Set Target : Name
       C17 :    If:NOT $$isempty:##SKCLedAlias2
       C18 :   SET VALUE   : Name :##SKCLedAlias2
       C19 :    END IF
       C20   :    Set Target:..
    It Should be in below img
    Led2.png
     
    Last edited: Mar 16, 2024


  2. sattam

    sattam Active Member


    Why Language English field coming?
    when I open and re accept the imported ledger then it perfect
     


  3. AMIT JALAN

    AMIT JALAN Member


    ;;Try This
    Code:
    [Function: Amit1]
     
    125  :    New Object : Ledger
    
    ;   126  :    Set Value  : Name  : "Amit"
       127  :    Set Value  : Parent  : "Capital Account"
    
    AJ1    : Insert Collection Object    : LANGUAGENAME
    AJ2    : Set Value    : LANGUAGEID    : @@EnglishLanguageId
    
       C09  :    INSERT COLLECTION OBJECT : Name
       C10   :   Set Target : Name
       C11 :    If:True
       C12 :   SET VALUE   : Name :"Amit"
       C13 :    END IF
       C14   :    Set Target:..
    
       C15  :    INSERT COLLECTION OBJECT : Name
       C16   :   Set Target : Name
       C17 :    If:True
       C18 :   SET VALUE   : Name :"Jalan"
       C19 :    END IF
       C20   :    Set Target:..
       AJ100    : Create Target
     
    Last edited: Mar 17, 2024
    sattam likes this.


  4. sattam

    sattam Active Member


    Thanks Amit ji its working
     


  5. sattam

    sattam Active Member


    Its working earlier now its getting error in tally data
    I think there might be some problem
     


  6. Sai Vineeth

    Sai Vineeth Active Member


    Replace
    Code:
    AJ1 : Insert Collection Object : LANGUAGENAME
    AJ2 : Set Value : LANGUAGEID : @@EnglishLanguageId
    
    with
    Code:
    AJ1 : Set Target : LANGUAGENAME
    
    Language is already created with name(Name = LANGUAGENAME[0].NAME[0])
    Inserting LANGUAGENAME collection object again creates another LANGUAGENAME object which is not desired.
    upload_2024-3-18_11-11-34.png
     
    Last edited: Mar 18, 2024
    sattam likes this.


  7. sattam

    sattam Active Member


    But result is same
    Led1.png
     


  8. sattam

    sattam Active Member


    Code:
    125  :     New Object : Ledger
       
        ;126   :     Set Value  : Name           : $Name
        127   :     Set Value  : Parent         : $$ReportObject:$$CollectionFieldByKey:$Parent:$Name:SmpGroupLedgers
       
        AJ1    : Set Target : LANGUAGENAME
        ;AJ2    : Set Value    : LANGUAGEID    : @@EnglishLanguageId
       
        C03  :     INSERT COLLECTION OBJECT : Name
        C04    :    Set Target : Name
        C06 :    SET VALUE    : Name :$Name
        C08    :     Set Target:..
       
        C09  :     INSERT COLLECTION OBJECT : Name
        C10    :    Set Target : Name
        C11 :     If:NOT $$isempty:##SKCLedAlias1
        C12 :    SET VALUE    : Name :##SKCLedAlias1
        C13 :     END IF
        C14    :     Set Target:..
       
        C15  :     INSERT COLLECTION OBJECT : Name
        C16    :    Set Target : Name
        C17 :     If:NOT $$isempty:##SKCLedAlias2
        C18 :    SET VALUE    : Name :##SKCLedAlias2
        C19 :     END IF
        C20    :     Set Target:..
       
        C21  :     INSERT COLLECTION OBJECT : Name
        C22    :    Set Target : Name
        C23 :     If:NOT $$isempty:##SKCLedAlias3
        C24 :    SET VALUE    : Name :##SKCLedAlias3
        C25 :     END IF
        C26    :     Set Target:..
        
     


  9. sattam

    sattam Active Member



  10. sattam

    sattam Active Member


    Please provide solution for import ledger master with 2 or more allias or want to alter already created ledger with 2 or more allias
    Is there any other way
     


  11. Sai Vineeth

    Sai Vineeth Active Member


    First repair the data or use backup data before trying old code.
    next since we cannot use default language name collection object that is created, we can delete it, use Insert Collection object and set language id (don't forget to set first name in language name as actual name of ledger)
    For alter also use same technique
    upload_2024-3-18_11-5-21.png
    in Backend
    upload_2024-3-18_11-7-32.png
     


  12. Sai Vineeth

    Sai Vineeth Active Member


    Code:
    [Function : TC_CreateLedgerFunc]
        125      :    NewObject : Ledger
        126      :    Set Value  : Name  : "Test Ledger"
        127      :    Set Value  : Parent  :"Sundry Debtors"
        127D    :     DELETE COLLECTION OBJECT: LanguageName
        128     :     Insert Collection Object    : LanguageName
        128B    :     Set Value    : LANGUAGEID    : @@EnglishLanguageId
        129     :   Insert Collection Object    : Name
        130     :   Set Target  : Name
        131     :   Set Value    :Name:"Test Ledger"
        132      :   Set Target    :..
      
        133     :     Insert Collection Object    : Name
        134     :   Set Target  : Name
        135     :   Set Value    :Name:"Alias1"
        136       :   Set Target    :..
       
        137     :   Insert Collection Object    : Name
        138     :   Set Target  : Name
        139     :   Set Value    :Name:"Alias2"
        140      :   Set Target    :....
        ;150    :     Log Target         : TgtObj.txt
       C2sdfd1    : Create Target
     


  13. sattam

    sattam Active Member


    1st this is working then I log out from tally again log in then data corrupt IMG3.png
     


  14. Sai Vineeth

    Sai Vineeth Active Member


    follow this
    if issue exists after that
    uncomment ;150 : Log Target : TgtObj.txt
    and share TgtObj.txt along with full code you used
     


  15. NiravMerchant

    NiravMerchant Active Member


    also the problem is it creates new Ledger instead changing the name of Existing one
     


  16. narayane88

    narayane88 Active Member


    Following code is for importing Name and also multiple alise & working fine


    Code:
    000 : SET : Counter   : 0 
        001 : START PROGRESS  : ($$NumItems:codewiseFilter)   : "Importing Master" : @@CmpMailName : "Importing Party Ledger ..." ;+ $$NewLine + $$String:($$NumItems:VCHLVExcellVariableBillWise)+$$String:"/"+$$String:##Counter
       
        030        : Walk Collection:codewiseFilter
        31        : Set:MasterCode1:$MasterCode
       
        036        :Set:VlStatecode:($$StringPart:$PartyGSTn:0:2)
        037        : Set    :ExcelCompanyState:@@ExcelCompanyState
        038        :Set:ExcelstateName:@@ExcelstateName
    
        060      :     IF :$$IsEmpty:$Name:Ledger:##MasterCode1
       
        070        :            NEW OBJECT            : Ledger
    
       
       
        043      :            Set Value                : Name                     : $PartyName +" ("+ ##MasterCode1+ ")"
        120      :           Set Value               : Parent                 : "Sundry Debtors"
        130        :            Set Value                : GSTRegistrationType    : if $$IsEmpty:$PartyGSTn or $PartyGSTn = "NO"  Then "Unregistered" else "Regular"
        140        :            Set Value                : PartyGSTIN            : if $$IsEmpty:$PartyGSTn or $PartyGSTn = "NO" then "" else $PartyGSTn
        150        :            Set Value                : CountryofResidence    : "India"
        160        :            Set Value                : LedStateName            : if $$IsEmpty:##ExcelstateName then ##ExcelCompanyState else ##ExcelstateName
        170        :            Set Value                :IsBillWiseOn            :"No"
        180        :    Walk Collection:PartyFilter
        ;181        : Log:"Before insert collection" + $PartyName
        190        :     Insert Collection Object: Name :LanguageName : First
       
        200        :         Set Value:Name:$PartyName
        ;210        : Log:$PartyName
        220        : Set Target:...
        230        : End Walk
       
       
        240      :        CREATE TARGET
        250      :       END IF
        260     :                 INCREMENT             : Counter
        270     :                 SHOW PROGRESS             : ##Counter
        280        :     End Walk
        290    :     END PROGRESS
        ;101        :    Msg Box: "Party Ledger Auto Creation !!!":"Party Ledger Master Imported Successfully !!!"
        300     :     RETURN
    
     


Share This Page