Attaching a File

Discussion in 'Tally Developer' started by Taufeeq Shaikh, Nov 6, 2013.

    
  1. Taufeeq Shaikh

    Taufeeq Shaikh Active Member


    Dear Experts,

    I have made a tdl file for attaching a file. My Problem is that the Complete File Path with extension is not getting changed. Am hereby attaching the TDL kindly help.
     

    Attached Files:



  2. Taufeeq Shaikh

    Taufeeq Shaikh Active Member


    It only changes when we are making the Full Path Blank then again we have to re select for the changes. So it is not changing / updating simultaneously while changing the File.
     



  3. Dear sir,
    the code is very good
    just make changes as in save file field
    Set As : ($$LocaleString:$Filepath)+"\"+($$LocaleString:$FileName)
    and set always : yes

    thats it your code is best one

    regards
    Rajendra Mithari
    9325509009
     


  4. Taufeeq Shaikh

    Taufeeq Shaikh Active Member


    Dear All,

    I have made some changes but still not getting success. Kindly help. I have added two option for opening the file in the Voucher Level and Uploading it if needed. But how to set path ??? And the problem is the full path is not getting updated as and when it is selected or changed.


    [#Part: VCH Narration]

    Add : Line : Attc

    ;;[!Part: BankDet VCH Narration]
    ;;Add : Line: attachfile

    [#Form: Accounting Voucher]

    Add : Button : Open File


    [Button : Open File]

    Key : Ctrl + O
    Action : Exec Command: $Fullpath



    [Line: Attc]

    Field: Medium Prompt, Attinfo
    Local: Field: Medium Prompt: Info: "Want to Attach File ? "
    Space Top: 1

    [Field: Attinfo]

    Use: Logical Field
    Storage : Enableprenarration
    Set as: If $$IsEmpty:$$Value then "No" else $$Value
    Sub Form: Attchdet Rep: $$Value = "Yes"


    [Report : Attchdet Rep]

    Form : Attchdet Form

    [Form : Attchdet Form]

    Parts: Attchdet Part
    Height : 15% Page
    Width : 90% Page
    On: Form Accept : CALL : TSPLSmpRefreshFile
    Add: Button : Upload File

    [Part : Attchdet Part]

    Line : attachfile


    [Line: attachfile]

    Fields : Short Prompt, Dirpath, Filename, Savefile
    Local : Field : Short Prompt : Info: $$LocaleString:"File Path"

    [System: UDF]

    Dirpath: String : 1101
    FileName: String : 1102
    Fullpath: String : 1103

    [Button : Upload File]

    Key : Ctrl + S
    ;;Action : CopyFile:##MyDstFilePath: ##Fullpath
    Action : Exec Command: $Fullpath

    [Field: Dirpath]

    Use : Name Field
    Color: Blue
    Border: Thin Bottom
    Set As: ##TSPLSmpDirectoryPath
    Modifies : TSPLSmpDirectoryPath : True
    Tooltip : "Enter the folder path from where the files are to be listed"
    ;; Skip Forward: Yes
    Storage: dirpath
    On : sELECT : Yes : Modifies : #dirpath


    [Field: Filename]

    Use : Name Field
    Table : List of Files, Not Applicable , End of list
    Set Always : Yes
    Show Table : Always
    Align : Center
    Width : 40% Page
    Tooltip : "Select a file from the Table"
    Storage :FileName
    Modifies : TSPLFilename : True
    ;;On : sELECT : Yes : Modifies : #filename

    [Field: savefile]

    Use : Name Field
    ;;On : Focus : Yes : CALL : TSPLSmpRefreshFile
    ;;Table : Attchpath
    ;; Set Always : Yes
    ;; Show Table : Always
    ;; Align : Center
    ;;Set As : @@TSPLSmpDirectoryPath + "\" + @@Filenm
    Set As : $Filepath + "\" + $FileName
    Storage :Fullpath
    ;;Invisible : Yes


    [Field: openfile]

    Use : Name Field
    Set As : "Open"
    Key : Execute File
    ;;Skip : Yes
    Color : Black
    Print FG : Pale Leaf Green
    Border : TQ
    Width : 5




    [Border: TQ]

    Top : Thick, Double
    Bottom : Thick, Double
    Left : Thick, Double
    Right : Thick, Double


    [Collection: List of Files]

    Title : $$LocaleString:"List of Files"
    Data Source : Directory : #TSPLSmpDirectoryPath
    Filter : TSPLSmpTextFiles
    Format : $Name, 25
    Format : $FileSize, 15
    ;;Format : $IsReadOnly, 15
    Format : $LastModifiedDate, 15
    Format : $LastModifiedTime, 15

    [Collection: AttchPath]

    Variable : Filename
    Filter : TSPLSmpAttchFiles



    [System: Variable]

    TSPLSmpDirectoryPath : "C:\TDL"

    ;;[System: Variable]

    ;; MyDstFilePath : "D:\TAUFEEQ"



    [System: Formula]

    ;; Specify the required Directory Path
    TSPL Smp Directory Path : ##TSPLSmpDirectoryPath
    TSPL Smp File Name : ##TSPLFilename
    ;; TSPL Smp Text Files : $$TSPLSmpRefreshTable:#TSPLSmpDirectoryPath AND NOT $$IsDirectory:$Name AND (($Name CONTAINS ".txt" OR $Name CONTAINS ".xml" OR $Name CONTAINS ".sdf" OR $Name CONTAINS ".tdl") AND $Name NOT CONTAINS "tdlserver")
    TSPL Smp Text Files : $$TSPLSmpRefreshTable:#TSPLSmpDirectoryPath
    Filenm : $$TSPLSmpRefreshfile:#TSPLFilename


    ;; Dummy Function introduced to Refresh the Table dependent on the Previous
    ;; Field Value i.e., User Input
    [Function: TSPLSmpRefreshTable]

    Parameter : pTempVar : String
    00 : RETURN : True

    [Function: TSPLSmpRefreshFile]

    Parameter : attchfile : String
    OO : RETURN : True



    ;; Variable declaration to hold the last updated Directory path
    [Variable: TSPLSmpDirectoryPath]

    Type : String
    Persist : Yes

    [Variable: TSPLFilename]

    Type : String
    Persist : Yes
     



  5. [#Part: VCH Narration]
    Add : Switch : BankDetRcpt : BankDet VCH Narration

    [!Part: BankDet VCH Narration]
    Add : Line : attachfile

    [Line: attachfile]
    Fields : Short Prompt, dirpath, filename, savefile, openfile
    Local : Field : Short Prompt : Info: $$LocaleString:"Attach File."

    [System: UDF]
    Filepath : String : 1101
    FileName : String : 1102
    Fullpath : String : 1103

    [Key : Execute File]
    Key : Left Click
    Action : Exec Command: $Fullpath
    ;; Action : CopyFile:##MyDstFilePath: ##MySourceFilePath

    [Field: dirpath]
    Use : Name Field
    Color : Blue
    Border : Thin Bottom
    Set As : ##TSPLSmpDirectoryPath
    Modifies : TSPLSmpDirectoryPath : True
    Tooltip : "Enter the folder path from where the files are to be listed"
    ;; Skip Forward : Yes
    Storage : Filepath

    [Field: filename]
    Use : Name Field
    Table : List of Files, Not Applicable , End of list
    Set Always : Yes
    Show Table : Always
    Align : Center
    Width : 40% Page
    Tooltip : "Select a file from the Table"
    Storage : FileName
    Modifies : Pathupdate : True

    [Field: savefile]
    Use : Name Field
    Set As : ($$LocaleString:$Filepath)+"\"+($$LocaleString:$FileName)
    Storage : Fullpath
    ;; Invisible : Yes
    Set Always: Yes


    [Field: openfile]
    Use : Name Field
    Set As : "Open"
    Key : Execute File
    ;; Skip : Yes
    Color : Black
    Print FG : Pale Leaf Green
    Border : TQ
    Width : 5

    [Border: TQ]

    Top : Thick, Double
    Bottom : Thick, Double
    Left : Thick, Double
    Right : Thick, Double

    [Collection: List of Files]
    Data Source : Directory : #TSPLSmpDirectoryPath
    Filter : TSPLSmpTextFiles

    [System: Variable]
    TSPLSmpDirectoryPath : "D:\Taufeeq\Tally TDL's"

    [System: Formula]
    ;; Specify the required Directory Path
    TSPL Smp Directory Path : ##TSPLSmpDirectoryPath
    ;; TSPL Smp Text Files : $$TSPLSmpRefreshTable:#TSPLSmpDirectoryPath AND NOT $$IsDirectory:$Name AND (($Name CONTAINS ".txt" OR $Name CONTAINS ".xml" OR $Name CONTAINS ".sdf" OR $Name CONTAINS ".tdl") AND $Name NOT CONTAINS "tdlserver")
    TSPL Smp Text Files : $$TSPLSmpRefreshTable:#TSPLSmpDirectoryPath
    ;; Dummy Function introduced to Refresh the Table dependent on the Previous
    ;; Field Value i.e., User Input
    [Function: TSPLSmpRefreshTable]

    Parameter : pTempVar : String
    00 : RETURN : True

    ;; Variable declaration to hold the last updated Directory path
    [Variable: TSPLSmpDirectoryPath]

    Type : String
    Persist : Yes

    [Variable: Pathupdate]

    Type : String
    Persist : Yes
     
    manish sabharwal likes this.


  6. manish sabharwal

    manish sabharwal New Member


    :)Realy good think & code
     


  7. JObimon Arackal JOhn

    JObimon Arackal JOhn Active Member



  8. N vinoth

    N vinoth Guest


    what is the purpose to make this tdl? i dont know kindly explain Mr.Taufeeq Shaikh
     


  9. Taufeeq Shaikh

    Taufeeq Shaikh Active Member


    Mr. N Vinoth it is very useful at company level and mass data maintenance.
     


  10. Taufeeq Shaikh

    Taufeeq Shaikh Active Member


    Thanks to all for motivating me. Hope i can give more and more to the experts.
     


  11. Ras Raj

    Ras Raj Member


    Not getting result....

    Please upload final code....

    Thanks
     


  12. Taufeeq Shaikh

    Taufeeq Shaikh Active Member


    Mr Ras Raj.

    The File is attached herewith. You will get an option for Opening as well as Uploading the file in the Sub Form of Attachment Field.
     

    Attached Files:

    Ras Raj and Maulik Patel like this.


  13. G Vijay

    G Vijay Member


    thank you...
     


  14. Maulik Patel

    Maulik Patel Active Member


    Good Work Taufeeq.
     


  15. Ras Raj

    Ras Raj Member



    Show some error in Line No.81
    "On : sELECT : Yes : Modifies : #dirpath"

    Sir, Please check & reply..
    Thanks
     


  16. mubarakmb

    mubarakmb New Member


    Thank You. A very helpful one
     


  17. mpal2311

    mpal2311 Active Member


    Great.
     


  18. vijayakumar

    vijayakumar New Member


    Brilliant work Taufeeq....
     



  19. good work Taufeeq
     


Share This Page